如何在CentOS上创建docker注册表镜像 [英] How to create docker registry mirror on CentOS
问题描述
我尝试在docker-registry中创建镜像。我已阅读了此中的教程。并使用此中的方式。我确定我已经添加了docker守护进程的变量。我在mac OS X上成功了,但是在我的centOS上它根本不起作用。
I try and try to create mirror in docker-registry. I have read the tutorial in this. And use the way in this. I'm sure I have add variable to docker daemon. And I succeed on mac OS X. But it didn't work at all on my centOS.
我使用这个命令运行我的docker守护进程:
I run my docker daemon using this command:
docker -g /opt/apps/docker/lib --insecure-registry http://10.11.150.76:5555 --registry-mirror=http://10.11.150.76:5555 -d
我使用此命令检查docker守护进程: / p>
and I use this command to check docker daemon:
ps -ef | grep "docker"
它真的添加到docker:
It really has added to docker:
root 1232 30203 0 20:47 ? 00:00:00 docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 10022 -container-ip 172.17.0.22 -container-port 22
root 1322 735 0 20:57 pts/7 00:00:00 grep --color=auto docker
root 30202 1 0 20:15 ? 00:00:00 sudo http_proxy=http://10.16.10.129:9526/ docker -g /opt/apps/docker/lib --insecure-registry http://10.11.150.76:5555 --registry-mirror=http://10.11.150.76:5555 -d
然后,我使用此命令创建镜像: / p>
Then, I use this command to create mirror:
docker run -d -p 5555:5000 -e STORAGE_PATH=/mirror -e STANDALONE=false -e MIRROR_SOURCE=https://registry-1.docker.io -e MIRROR_SOURCE_INDEX=https://index.docker.io -v /Users/v11/Documents/docker-mirror:/mirror --restart=always --name mirror registry
接下来,我拉新图像,例如:
Next,I pull the new image, for example:
docker pull ubuntu
它没有工作,因为我在我的路径/ Users / v11 / Documents / docker-mirror中找不到图像。我打印镜像日志信息,它会显示错误信息:
It did't work at all, because I can't find image in my path "/Users/v11/Documents/docker-mirror". I print the mirror log information and it will show me error information:
ConnectionError:HTTPSConnectionPool(host ='index.docker.io'
port = 443):最大重试次数超过了url:
/ v1 / repositories / library / hello-world / images(引起:[Errno 110]连接超时)
ConnectionError: HTTPSConnectionPool(host='index.docker.io', port=443): Max retries exceeded with url: /v1/repositories/library/hello-world/images (Caused by : [Errno 110] Connection timed out)
和docker log:
and docker log :
INFO POST / v1。 19 / images / create?fromImage = hello-world%3Alatest
ERRO [0027]无法创建 http ://10.11.150.76:5555 / :
无效注册端点 https:// 10.11.150.76:5555/v0/ :无法
ping注册表端点 https:/ /10.11.150.76:5555/v0/ v2 ping尝试
失败,出现错误:Get https://10.11.150.76:5555/v2/ :EOF v1 ping
尝试失败并显示错误:Get https://10.11.150.76:5555/v1/_ping :
EOF。如果这个私人注册表只支持HTTP或HTTPS
未知CA证书,请将- insecure-registry
添加到守护进程的论据。在HTTPS的情况下,如果您有权访问注册表的CA证书,则不需要
10.11.150.76:5555
标志;只需将CA证书放在
/etc/docker/certs.d/10.11.150.76:5555/ca.crt
INFO[0023] POST /v1.19/images/create?fromImage=hello-world%3Alatest ERRO[0027] Unable to create endpoint for http://10.11.150.76:5555/: invalid registry endpoint https://10.11.150.76:5555/v0/: unable to ping registry endpoint https://10.11.150.76:5555/v0/ v2 ping attempt failed with error: Get https://10.11.150.76:5555/v2/: EOF v1 ping attempt failed with error: Get https://10.11.150.76:5555/v1/_ping: EOF. If this private registry supports only HTTP or HTTPS with an unknown CA certificate, please add
--insecure-registry 10.11.150.76:5555
to the daemon's arguments. In the case of HTTPS, if you have access to the registry's CA certificate, no need for the flag; simply place the CA certificate at /etc/docker/certs.d/10.11.150.76:5555/ca.crt
我真的搜索很多相关的问题找到解决。但我还是不知道。怎么做?谢谢。
I really search many relevant questions to find solving. But I still have no idea about it. How to do it? Thanks.
推荐答案
'-registry-mirror'标志到docker已被设计为仅 工作镜像官方docker.io仓库。在2015年,他们表示注册表V2将使用'--registry-mirror'标志,但是这种功能仍然不可用。
The '--registry-mirror' flag to docker has been designed to only work for mirroring the official docker.io repository. In 2015, they said the registry V2 would be made to work with the '--registry-mirror' flag, but this capability is still unavailable.
这篇关于如何在CentOS上创建docker注册表镜像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!