16

I'm following the guide at https://docs.docker.com/get-started/part2/#publish-the-image

Throughout the guide I've had trouble with this error sometimes coming up and sometimes when I rerun the commands they will work.

docker push %username%/%repository%:%tag%

I will get a response of Using default tag: latest 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 using Windows Home with Docker Toolbox.

Please let me know if any additional information is needed.

Eric
  • 569
  • 1
  • 7
  • 10

8 Answers8

13

Simply go to the Docker's Settings > Network and change DNS Server radio button to Fixed

enter image description here

Serge V.
  • 3,377
  • 3
  • 20
  • 28
10

Unfortunately answers above didn't help in my case, but restarting Docker did.

screen

Dmytro Melnychuk
  • 2,285
  • 21
  • 23
5

For anyone else who's looking I found the answer here which led me to here

Specifically for me these steps were helpful. In case the links break in the future.

This worked for Windows 10 Home/Docker Toolbox

  1. Right click on wifi icon on bottom right of the screen and open network and sharing center.
  2. Right click on the connection at "connections:"
  3. Click on Properties
  4. Uncheck IPv6
  5. Check IPv4
  6. Click properties
  7. Select radio button Use the following DNS addresses
  8. For preferred use 8.8.8.8
  9. Restart the computer and try again.
Eric
  • 569
  • 1
  • 7
  • 10
4

In case someone runs his own docker repo. I had a similar "Client.Timeout exceeded while awaiting headers" when running

docker login myownrepo.com:5000

It happened to be that i had port forwarding only for port 5000, and forgotten to add for port 5001. The issue was resolved by adding port 5001 (on my router) pointing to the same docker-repo-host.

Kostyantyn
  • 5,041
  • 3
  • 34
  • 30
2

Do not add proxy unless it is required to access registry. In my case behind corporate network, I had added proxy which resulted in timeout error, after removing the proxy configuration in Docker Desktop, it got resolved. Hope it helps somebody.

enter image description here

Mahesh Nayak
  • 208
  • 4
  • 14
1

"Client.Timeout exceeded while awaiting headers" is a symptom of several possible causes. In my case it was simply a case of the private network firewall blocking the docker client machine from accessing the registry host machine.

To test if that's the case (for whoever may be reading this), first try temporarily disabling the private network firewall.

For instance, if the private docker registry is hosted on Windows 10:

1) open Windows Security

2) click on Firewall & network protection

3) ensure Private Network is "active" and click on it

4) under "Microsoft Defender Wall" switch OFF private firewall

If the IP is suddenly accessible then you need to re-enable the firewall on the host and configure it to allow access to the docker registry.

MaxA
  • 66
  • 4
0

I had this problem as I was using docker-reg:5000 under WSL2. Adding it to /etc/hosts did not work.

As docker really works under windows, you need to add it to the WINDOWS hosts file. C:\Windows\System32\drivers\etc\hosts

4b0
  • 21,981
  • 30
  • 95
  • 142
James Gardiner
  • 382
  • 2
  • 8
0

In my case having a slow and not stable internet connection was causing the issue. So if it is possible to increase performance of your connection do that, but in my case i retried it multiple times and it worked after a while.