[英]Is there a way to download the container image from a pod in kuberentes environment?
Is there a way to download the container image from kuberentes pod?有没有办法从 kuberentes pod 下载容器镜像? Let say we have multiple containers running in a Pod and we want to download the container so we can do some stuff offline in that container.假设我们有多个容器在一个 Pod 中运行,我们想要下载容器,以便我们可以在该容器中离线做一些事情。 The reason we want to download from Kubernetes pod directly since most of the environment settings are already set and the container should able to start with a single docker command.我们想直接从 Kubernetes pod 下载的原因是因为大多数环境设置已经设置并且容器应该能够以单个 docker 命令启动。
It is like asking docker compose file from the kubernetes pod environment.这就像从 kubernetes pod 环境中询问 docker compose 文件。
You cannot do it by Kubernetes itself, by any special command, etc. Here is a discussion about it.你不能通过 Kubernetes 本身,通过任何特殊命令等来做到这一点。 这是关于它的讨论。
But you still can use docker commit
command right on the node and save a state of your container as a new image like that:但是您仍然可以直接在节点上使用docker commit
命令,并将容器的状态保存为这样的新图像:
kubectl describe $POD
.在详细的 pod 信息中获取容器的 ID 和节点: kubectl describe $POD
。 You need Container ID
and Node
values.您需要Container ID
和Node
值。docker commit $CONTAINER_ID saved-image:1
.连接到您在上一步中获得的节点并调用: docker commit $CONTAINER_ID saved-image:1
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.