'Docker: Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection

Since yesterday out of nowhere I'm not able to pull images anymore. And I can't login into docker with docker login. The same error appears:

Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

I'm not behind any proxy and all of my docker container itself work well. I'm running it at home and the only reverse proxy I use is running in a container and can't be the reason.

Running on:

  • Ubuntu 18.04.4 LTS
  • Docker version 19.03.5, build 633a0ea


Solution 1:[1]

This helped me:

sudo nano /etc/resolv.conf

Set the nameserver to 8.8.8.8.

Restart the docker demon.

sudo systemctl restart docker

Solution 2:[2]

Try to update /etc/resolv.conf

nameserver 8.8.8.8
nameserver 8.8.4.4

Solution 3:[3]

I added nameserver 8.8.8.8 in all my worker nodes and the issue was resolved

Solution 4:[4]

In my case, it gets resolved after configuring the proxy. I am using Windows Docker (Refer 'Proxy Configuration' section from here for more details)

Solution 5:[5]

This usually happens when you are behind the proxy OR on a corporate network. Though you export proxy locally on a shell docker doesn't understand that. So the workaround would be -

Create a file if not present - /etc/systemd/system/docker.service.d/http-proxy.conf

#Add proxy server details as below -

[Service]

Environment="HTTP_PROXY=http://proxy.example.com:port/" Environment="HTTPS_PROXY=https://proxy.example.com:port/"

(Notice the trailing '/' which is very important)

systemctl daemon-reload

systemctl restart docker

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Dmitry Krivolap
Solution 2
Solution 3 Sunil Varma
Solution 4 Naren Chejara
Solution 5