Héctor
Héctor

Reputation: 26034

Docker: Unable to pull image from remote private registry

I have a private registry running on 172.20.20.1. From another machine, I can use the HTTP API to retrieve registry info, for instance:

curl http:172.20.20.1:5000/v2/_catalog

works fine.

But I can't pull image from that registry:

docker pull 172.20.20.1:5000/my_image

I get 504 error (timeout).

Supposedly, I'm running the registry in non-secure mode. To do that, I have added in /etc/default/docker:

DOCKER_OPTS="--insecure-registry=172.20.20.1:5000"

and restarted docker service: sudo service docker restart, in all machines that run docker. Do I need to do something more?

Any help will be appreciated.

Upvotes: 1

Views: 2543

Answers (2)

VonC
VonC

Reputation: 1323045

I prefer running my private registry in secure tls mode.

docker run -d -p 5000:5000 --restart=always --name registry -v /path/to/certs:/certs -e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/crt -e REGISTRY_HTTP_TLS_KEY=/certs/key registry:2

Then, I add (in each other machine having to pull from that registry) the certificate to /etc/ssl/certs/ca-certificates.crt.
(with boot2docker, I add that directive in /var/lib/boot2docker/bootsync.sh in order to have that persistent across sessions)

I can then push/pull from any machine to that registry without issue.

Upvotes: 1

Héctor
Héctor

Reputation: 26034

I found the solution!

I have changed DOCKER_OPTS="--insecure-registry=172.20.20.1:5000" by DOCKER_OPTS="-D --tls=false ---insecure-registry 172.20.20.1:5000" and restarted;

$ sudo restart docker

and everything works fine.

Upvotes: 1

Related Questions