Docker:通过IP地址引用registry
我有一个我想推到我的registry(托pipe在localhost
)的Docker镜像。 我做:
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
主机推图像?
编辑
我以这种方式运行registry:
docker run -d -p 5000:5000 --restart=always --name registry registry:2
正如在“ 所有事情的知识产权 ”(由Jess Frazelle所述 )中所提到的那样,您应该能够使用docker 1.10来运行您的registry,并使用固定的IP地址。
它使用--net= --ip=
选项 。
# 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
您可以将此示例应用于您的registrydocker运行参数。
首先请检查您是否能够连接端口5000上的registry。在Linux / Windows中,您可以使用telnet执行此操作。 下面是命令。
$ telnet 172.20.20.20 5000
如果连接检查失败,请检查您的防火墙设置。
我不确定您是否正在运行您的运行registry与loginfunction。 但是从这个问题我可以假设你没有使用它。 在这种情况下,请将您的registry添加为您尝试访问registry的docker守护进程中不安全的registry。 这个过程在这里描述 – https://docs.docker.com/registry/insecure/
请让我知道如果成功。
- 在哪里保持与Docker / Docker-Compose一起使用的依赖关系(大文件或目录结构)?
- 从docker nginx / php-fpm安装在本地卷(Mac)上的Laravel无法写入会话文件
- 如何在Docker容器中设置核心文件大小?
- 不能生产 – 或消费 – 从容器内运行的卡夫卡经纪人
- 如何在Google Container Engine上运行私人泊坞窗图片
- Bluemix上的Docker运行命令不允许正确设置环境variables
- 在docker gitlab-ci-multi-runner上运行docker-compose
- 链接的docker-compose制作http请求的容器
- 无法执行目标io.fabric8:docker-maven-plugin:0.21.0:build window 10 home OR pro
- 如何从特定的git分支推送到AWS EC2服务容器(即“分段”)
- 来自fabric8的docker-maven-plugin:tomcat和postgres容器之间的连接