saurg saurg - 1 year ago 317
Linux Question

Error while pulling image from docker registry

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 dial tcp 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.

Answer Source

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="

Flush changes:systemctl daemon-reload Restart Docker: systemctl restart docker

see for details.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download