简体   繁体   English

可以在 docker 容器内推送 docker 图像吗?

[英]It is possible to push a docker image inside a docker container?

I have a docker-in-docker container, which we'll call "dind".我有一个 docker-in-docker 容器,我们称之为“dind”。 And a large image, which we'll call "LI".还有一张大图,我们称之为“LI”。

Dind is responsible for make some docker runs calls. Dind 负责进行一些docker 运行调用。 I need to run LI inside Dind.我需要在 Dind 中运行 LI。 Normally, I push LI to a registry and pull it inside Dind.通常,我将 LI 推送到注册表并将其拉入 Dind。 But I have a bad internet network.但我有一个糟糕的互联网网络。 it takes a whole life to do this...做这件事需要一生的时间...

So, I was thinking if it is possible to push a docker image inside a docker container.所以,我在想是否可以在 docker 容器内推送 docker 图像。

You can use docker registry container in your localhost and pull image from it in dind.您可以在本地主机中使用 docker 注册表容器,并从中提取图像。 Here is the link: https://hub.docker.com/_/registry这是链接: https://hub.docker.com/_/registry

You should not need to go over the network for this.为此,您不需要通过网络 go。

First, save LI to a local tarball首先, 将 LI 保存到本地 tarball

Then, in DIND use docker import .然后,在 DIND 中使用docker import

Or alternatively, when you run DIND mount the LI tarball directly或者,当您运行 DIND 时,直接安装 LI tarball

you have a image A and you need to run an image B in image A (as per my understanding) you have a bad network-你有一个图像 A,你需要在图像 A 中运行一个图像 B(根据我的理解)你有一个糟糕的网络 -

your docker file should look like:您的 docker 文件应如下所示:

from image A docker pull image B从图像 A docker 拉图像 B

build this image and keep it as Image C构建此映像并将其保留为 Image C

Image C should be your image for all the run which already has the Image B updated.图像 C 应该是所有已经更新了图像 B 的运行的图像。 Pull and Push Image when the connectivity is strong and you should be good.当连接性很强并且你应该很好时,拉和推图像。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM