Resolving the "request canceled while waiting for connection" Error in Docker for Windows

I'm currently learning how to use containers with Docker for Windows, but ran into a brick wall pretty early after installing it and trying to run the sample hello-world image. After executing docker run hello-world, I got the following response:

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).

In an attempt to resolve this, I created a Docker ID, confirmed my email address to activate it, then restarted Docker and opened a new Powershell prompt, but got the same result. My first thought was that this was a firewall issue, but when I checked my firewall configuration I found that Docker was already setup correctly for internet access.

After some Googling, it turned out my issue was much simpler. All I needed to do was switch Docker to use Windows containers instead of Linux containers (Linux containers are the default for Docker for Windows). You can do this by right-clicking on Docker in the task tray and selecting Switch to Windows containers... . After doing this, I restarted Docker and opened a new Powershell prompt for good measure, and it worked. I hope this helps you if you're having the same problem.

Comments

Popular Posts

The Cause and Solution for the "System.Runtime.Serialization.InvalidDataContractException: Type 'System.Threading.Tasks.Task`1[YourTypeHere]' cannot be serialized." Exception

How to Get Norton Security Suite Firewall to Allow Remote Desktop Connections in Windows

How to Determine if a Column Exists in a DataReader

Resolving the "n timer(s) still in the queue" Error In Angular Unit Tests

Setting Default Values in an Angular Reactive Form