1

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.

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

and I use this command to check docker daemon:

ps -ef | grep "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

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

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): Max retries exceeded with url: /v1/repositories/library/hello-world/images (Caused by : [Errno 110] Connection timed out)

and docker log :

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.

Community
  • 1
  • 1
v11
  • 2,124
  • 7
  • 26
  • 54
  • It seems like a connectivity issue, I'd remove `http://` in `--insecure-registry http://10.11.150.76:5555`. Try also to _browse_ the webservice using a web browser or a dedicated tool such as postman to make sure the service is available – superbob Jul 20 '15 at 15:22
  • @superbob I have tried to remove "http://", it still did't work – v11 Jul 21 '15 at 00:58
  • Did you try my other suggestion? – superbob Jul 21 '15 at 07:14
  • Yes. I'm sure service is available. I use browse to http://10.11.150.76:5000/v1/search , and it can show me local registry information. just port 5555 to mirror can't use. – v11 Jul 21 '15 at 07:25
  • There is something I don't understand, what is 10.11.150.76? The host IP, the container IP? Something else? – superbob Jul 21 '15 at 11:48
  • It's host IP where the mirror run. and 5555 it's mirror port. – v11 Jul 22 '15 at 00:59
  • If 10.11.150.76 is the host port, I don't understand how 10.11.150.76:5000/v1/search can work because the IP should be the container one, not the host one. I mean that 10.11.150.76:5555/v1/search and :5000/v1/search, but the other way around should not. – superbob Jul 22 '15 at 08:01
  • I think I use run -p 5000:5000 to map the container port to host port, So we can using host:[port] to connect container. – v11 Jul 22 '15 at 08:51
  • Maybe it is your issue, you should use 5000 port instead of 5555, if this solves your problem, I'll write an corresponding answer – superbob Jul 22 '15 at 09:06
  • @superbob I use the command what I asked in question is : -p 5555:5000. – v11 Jul 22 '15 at 10:47
  • why I said I can access to 10.11.150.76:5000/v1/search, because I have another container using registry. – v11 Jul 22 '15 at 10:48

1 Answers1

0

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.

Josiah
  • 571
  • 6
  • 12