Reputation: 347
I am trying to pull registry image
from docker.
docker run -d -p 5000:5000 --restart=always --name registry registry:2
But it gives an error like below:
docker: Error while pulling image: Get https://index.docker.io/v1/repositories/library/registry/images: dial tcp 52.73.159.23:443: getsockopt: no route to host.
I have set the proxy but it doesn't help. What could be the problem? I am running on Redhat linux 7.
Upvotes: 1
Views: 1492
Reputation: 347
If you are behind an HTTP proxy server, for example in corporate settings, you will need to add configure the Docker systemd service
file.
First, create a systemd
drop-in directory for the docker service:
mkdir /etc/systemd/system/docker.service.d
Now create a file called /etc/systemd/system/docker.service.d/http-proxy.conf
that adds the HTTP_PROXY
environment variable:
[Service]
Environment="HTTP_PROXY=http://proxy.example.com:80/"
Flush changes:systemctl daemon-reload
Restart Docker: systemctl restart docker
see https://docs.docker.com/engine/admin/systemd/#http-proxy for details.
Upvotes: 3