我有一个 Docker 镜像,我想推送到我的注册表(托管在localhost
). I do:
docker push localhost:5000/my_image
并且工作正常。但是,如果我标记图像并通过以下方式推送它:
docker push 172.20.20.20:5000/my_image
我收到一个错误。
The push refers to a repository [172.20.20.20:5000/my_tomcat] (len: 1)
unable to ping registry endpoint https://172.20.20.20:5000/v0/ v2
ping attempt failed with error:
Get https://172.20.20.20:5000/v2/: Gateway Time-out
不能通过IP引用registry吗?如果是这样,我如何从另一个主机推送一个不是的图像localhost
?
EDIT
我这样运行注册表:
docker run -d -p 5000:5000 --restart=always --name registry registry:2
正如《所有事物的 IP https://blog.jessfraz.com/post/ips-for-all-the-things/" (by 杰西·弗雷泽尔 https://github.com/jfrazelle),使用 docker 1.10,您应该能够使用固定 IP 地址运行注册表。
它使用--net= --ip=docker run 的选项 https://docs.docker.com/engine/reference/commandline/run/#connect-a-container-to-a-network-net.
# create a new bridge network with your subnet and gateway for your ip block
$ docker network create --subnet 203.0.113.0/24 --gateway 203.0.113.254 iptastic
# run a nginx container with a specific ip in that block
$ docker run --rm -it --net iptastic --ip 203.0.113.2 nginx
# curl the ip from any other place (assuming this is a public ip block duh)
$ curl 203.0.113.2
您可以将此示例改编为您的注册表 docker 运行参数。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)