设置远程私有Docker注册表 [英] Setting up a remote private Docker registry
问题描述
我需要一些关于设置远程私有Docker注册表的提示。
I need some tips on setting up a 'remote private Docker registry'.
README.md 主要关注在同一主机上运行的私有注册表,不指定其他机器如何远程访问它或者可能太复杂,不了解)。
README.md on Docker-Registry mainly focus on private registry running on the same host, does not specify how other machines can access it remotely (or maybe too complex to understand).
到目前为止,我发现这些线程:
So far I found these threads:
Docker:从另一个服务器的私人注册表中提取问题
(仍然是一个开放的线程,没有提供解决方案。关于 Github 提供代理提示,但是如何工作?)
Docker: Issue with pulling from a private registry from another server (Still an open thread, no solution offered. Further discussion on Github gives hint on proxy, but how does that work?)
创建远程私人注册ry
(可能最接近我正在寻找,但是我需要什么命令从其他机器访问注册表?)
Create a remote private registry (Maybe closest to what I'm looking for, but what command do I need to access the registry from other machines?)
如何使用您自己的注册表(同样,这个重点是在同一主机上运行注册表。它提到在443或44端口运行其他机器访问,但需要更多的细节!)
How to use your own registry (Again, this focuses on running registry on the same host. It did mention running on port 443 or 80 for other machines to access, but need more detail!)
运行的线索,任何输入非常感谢!
Running out of clues, any input very appreciated!
推荐答案
我可以通过参考这个设置一个远程私人注册表:
远程访问私人docker-registry
I was able to set up a remote private registry by referring to this: Remote access to a private docker-registry
步骤:
- 在注册表主机上,运行
docker run -p 5000:5000注册表
/ li>
- 在客户端主机上,通过
docker -d --insecure-registry 10.11.12.0:5000
启动Docker服务(将10.11.12.0替换为你自己的注册表ip,你可能想要守护过程,所以它将在shell关闭后继续运行。)
- On registry host, run
docker run -p 5000:5000 registry
- On client host, start Docker service by
docker -d --insecure-registry 10.11.12.0:5000
(replace 10.11.12.0 with your own registry ip, and you might want to daemonize the process so it'll continue running after shell closes.)
编辑: ,您可以编辑Docker的init脚本(/ etc / sysconfig / docker为RHEL / CentOS,/ var / lib / docker为Ubuntu / Debian)。添加此行 other_args = - insecure-registry 10.11.12.0:5000
,然后执行服务docker restart
。这是一个推荐的方法,因为它会守护Docker进程。
Alternatively, you can edit Docker's init script (/etc/sysconfig/docker for RHEL/CentOS, /var/lib/docker for Ubuntu/Debian). Add this line other_args="--insecure-registry 10.11.12.0:5000"
, then do a service docker restart
. This is a recommended method as it daemonizes the Docker process.
现在,尝试如果它有效:
Now, try if it works:
- 在客户端,下载一个忙碌的图片
docker pull busybox
- 给它一个新的标签
docker tag busybox 10.11.12.0:5000/busybox
- 将其推入注册表
docker push 10.11.12.0:5000/busybox
- 验证推送
docker search 10.11.12.0:5000/busybox
- 删除所有图像并将其从注册表中取出
docker rmi busybox 10.11.12.0:5000:busybox
docker pull 10.11.12.0:5000:busybox
- 运行
docker图像
应该具有您从自己的远程私人注册表中提取的图像。 >
- In client, download a busybox image
docker pull busybox
- Give it a new tag
docker tag busybox 10.11.12.0:5000/busybox
- Push it to registry
docker push 10.11.12.0:5000/busybox
- Verify the push
docker search 10.11.12.0:5000/busybox
- Remove all images and pull it from your registry
docker rmi busybox 10.11.12.0:5000:busybox
docker pull 10.11.12.0:5000:busybox
- Run
docker images
should have the image you just pulled from your own remote private registry.
这篇关于设置远程私有Docker注册表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!