如何将图像从容器推送到同级容器中的注册表

时间:2018-11-16 12:42:02

标签: docker dns docker-registry

我正在尝试将图像从一个容器内部推送到同级容器中的注册表,以共享相同的覆盖网络。

我尝试过的例子:

erik@work ~ $ docker run --network mmmmm -it -v /var/run/docker.sock:/var/run/docker.sock ubuntu:latest sh -c "apt-get update ; apt-get install docker.io -y ; bash"

...

root@01574361ba59:/#
root@01574361ba59:/# docker ps -a
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES
01574361ba59        ubuntu:latest       "sh -c 'apt-get upda…"   7 minutes ago       Up 7 minutes                            nervous_banach
9f7019fca0a6        registry:2.6.2      "/entrypoint.sh /etc…"   25 minutes ago      Up 25 minutes       5000/tcp            foobar.xxx.yy
root@01574361ba59:/# 
root@01574361ba59:/# docker tag ubuntu foobar.xxx.yy:5000/ubuntu
root@01574361ba59:/# 
root@01574361ba59:/# docker push foobar.xxx.yy:5000/ubuntu
The push refers to a repository [foobar.xxx.yy:5000/ubuntu]
Get https://foobar.xxx.yy:5000/v1/_ping: dial tcp: lookup foobar.xxx.yy on 91.126.225.225:53: no such host
root@01574361ba59:/# 
root@01574361ba59:/# ping foobar.xxx.yy
PING foobar.xxx.yy (10.0.0.4) 56(84) bytes of data.
64 bytes from foobar.xxx.yy.xxx (10.0.0.4): icmp_seq=1 ttl=64 time=0.037 ms

请注意ip diff 91.126.225.225:53 <> 10.0.0.4

0 个答案:

没有答案