Bobcares

Cannot download Docker images behind a proxy – How we fix it

by | Apr 8, 2021

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.

mkdir /etc/systemd/system/docker.service.d

Next, we 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/"

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:

Environment="HTTP_PROXY=http://proxy.example.com:80/"
Environment="NO_PROXY=localhost,127.0.0.0/8,docker-registry.somecorporation.com"

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]

 

Conclusion

Today, we saw how our Support Engineers resolve this error message for our customers.

Are you using Docker based apps?

There are proven ways to get even more out of your Docker containers! Let us help you.

Spend your time in growing business and we will take care of Docker Infrastructure for you.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.