简体   繁体   English

有没有办法从 kuberentes 环境中的 pod 下载容器镜像?

[英]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命令,并将容器的状态保存为这样的新图像:

  1. Get container's ID, and node where it is running in detailed pod information: kubectl describe $POD .在详细的 pod 信息中获取容器的 ID 和节点: kubectl describe $POD You need Container ID and Node values.您需要Container IDNode值。
  2. Connect to a node which you got on a previous step and call: docker commit $CONTAINER_ID saved-image:1 .连接到您在上一步中获得的节点并调用: docker commit $CONTAINER_ID saved-image:1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将一根管子装入Kuberentes的一个容器中? - How can one pipe stdin into a container in a pod in Kuberentes? 有没有办法在 Pod 初始化过程中查看 Kubernetes 镜像下载进度? - Is there a way to view the Kubernetes image download progress during pod initialization? 如何在Kuberentes上诊断“错误同步窗格”窗格? - How to diagnose a “Error syncing pod” pod on Kuberentes? IP Pod到容器环境变量 - IP Pod to container environment variable 有没有办法从文件创建的 configmap 在 pod 中配置环境变量? - Is there a way to configure environment variables in a pod from a configmap created from a file? 从 pod 访问环境变量 - Accessing environment variables from a pod Kuberentes Volume可以通过多节点上传和下载文件 - Kuberentes Volume to upload and download files with multinodes 有没有办法将 SIGTERM 从一个容器发送到 Kubernetes pod 中的另一个容器 - Is there a way to send SIGTERM from one container to another container within a Kubernetes pod 如果容器不健康,有没有办法自动重启 Pod 部署 - Is there a way to automatically restart a pod deployment if a container is unhealthy 注册表中存在容器映像,但pod显示“ ErrImagePull” - Container image exists in registry but pod shows 'ErrImagePull'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM