Cannot download Docker images behind a proxy? We can help you resolve it.
Here at Bobcares, we have seen several such Docker-related issues while troubleshooting Docker issues as part of our Docker Hosting Support.
Today we’ll see how to fix this Docker error.
What to do when we Cannot download Docker images behind a proxy
We had a customer who installed Docker on his Ubuntu server. Then he tried running the below command.
sudo docker pull busybox
As a result, he received the below error.
Pulling repository busybox 2021/03/16 09:37:07 Get https://index.docker.io/v1/repositories/busybox/images: dial tcp: lookup index.docker.io on 127.0.1.1:53: no answer from server
Now let’s see how our Support Engineers resolve this error for our customers.
In order to resolve this problem, we first create a systemd drop-in directory for the Docker service by running the below command.
Next, we create a file called /etc/systemd/system/docker.service.d/http-proxy.conf that adds the HTTP_PROXY environment variable:
Note: In case, if you have internal Docker registries that you need to contact without proxying you can specify them via the NO_PROXY environment variable:
After that, we flush the changes by running the below command.
$ sudo systemctl daemon-reload
Then we verify if the configuration is loaded or not. For that, we run the below command.
$ sudo systemctl show --property Environment docker Environment=HTTP_PROXY=http://proxy.example.com:80/
Finally, we restart the Docker by running the below command.
$ sudo systemctl restart docker
Finally, this fixed the Docker error.
[Need any further assistance in fixing Docker errors? – We’re available 24*7]
Today, we saw how our Support Engineers resolve this error message for our customers.