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

Viewed 47520

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
6 Answers

This helped me:

sudo nano /etc/resolv.conf

Set the nameserver to 8.8.8.8.

Restart the docker demon.

sudo systemctl restart docker

Try to update /etc/resolv.conf

nameserver 8.8.8.8
nameserver 8.8.4.4

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

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

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

I had a similar issue when I upgraded to using Cloudflare. What solved this issue for me was:

  • navigate to your DNS record either in Cloudflare or google cloud,
  • delete the DNS record for docker and nexus if you have that,
  • then the DNS record should be automatically recreated,

and voila the issue is resolved.

Related