SoFunction
Updated on 2025-04-11

Say goodbye to Docker request timeout step by step troubleshooting and detailed solutions

docker running system

System: Ubuntu

Problem phenomenon

On the ubuntu system, after installing Docker, try to rundocker run hello-worldWhen testing whether the docker installation is successful, an error is reported, and the error message is as follows:

docker: Error response from daemon: Get "/v2/": net/http: request canceled while waiting for connection ( exceeded while awaiting headers).
See 'docker run --help'.

Solution

There are many solutions for this connection timeout problem on the Internet, and I have tried it based on the online solution, but some processing solutions do not work, and are also listed below. I hope it will be helpful to you.

1. Modify the docker image source (local modification cannot be performed)

Use the commandsudo vim /etc/docker/(If the file does not exist, a new one will be automatically createdFile), replace the image source information in the file

{
    "registry-mirrors": ["",
      "",
      "",
      "",
      "",
      "",
      "",
      "",
      "",
      "",
      "",
      "",
      ""]
  }

Docker service needs to be re-modified

sudo systemctl daemon-reload
sudo systemctl restart docker

Check whether it is effective:Check the docker system information docker info and view the content address just configured in the registry mirror.

2. Modify the DNS service configuration

  • Check DNS service configuration,/etc/
cat /etc/
  • To view the IP address information behind the nameserver, or if there is a problem with the IP address displayed, you can try to modify the file.
nameserver 114.114.114.114
nameserver 8.8.8.8

3. Obtain the available mirror source (successfully pulling the mirror source)

After none of the above methods worked, I searched for a long time and finally found an available mirror source.

/

Add the above information toIn the file, then restart the service.docker run hello-worldTry to pull the mirror and it was successful.

Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
c1ec31eb5944: Pull complete 
Digest: sha256:d211f485f2dd1dee407a80973c8f129f00d54604d2c90732e8e320e5038a0348
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 /

For more examples and ideas, visit:
 /get-started/

Summarize:

In this blog, there are a range of practical solutions to deal with Docker pull mirror timeouts. We first analyzed the factors that may cause this error, such as network connection problems, DNS configuration errors, and proxy settings. Next, we explain in detail how to solve this problem by adjusting Docker configuration files, modifying DNS options, and checking system proxy settings.
Through these steps, I believe you have been able to effectively resolve the "exceeded while awaiting headers" error and make your Docker container run smoothly. Mastering these skills will not only help you deal with current problems, but also provide you with powerful tools when facing similar challenges in the future.

I hope this tutorial will be helpful to you and help you become more handy during the use of Docker. Thank you for reading, looking forward to your feedback!

This is the article about Docker request timeout troubleshooting and detailed solutions. For more related Docker request timeout troubleshooting and resolution, please search for my previous articles or continue browsing the related articles below. I hope everyone will support me in the future!