Peter-John Lightfoot

Programmer | Architect | Solutionist

Docker for Windows (on Hyper-V): Fix the Network Communication issue

Docker for Windows now runs natively on Hyper-V, and you’re super stoked to try it… So you grab the download, install it, and try the hello world instructions… except:

   bash-3.2$ docker run hello-world
   Unable to find image 'hello-world:latest' locally
   Pulling repository docker.io/library/hello-world
   Network timed out while trying to connect to https://index.docker.io/v1/repositories/library/hello-world/images. You may want to check your internet connection or if you are behind a proxy.

…but you just downloaded the Docker installer moments ago, so you know your internet connection is fine… and you’re not behind a proxy. Now what?! Well, off to the logs you go, and you see it being spammed with something to the effect of:

   listen tcp 10.0.75.1:53: bind: The requested address is not valid in its context.
   Waiting for the port/IP to become available

Where did that address come from?.. and off to Hyper-V we go.

  • [Windows + S] → Hyper-V Manager → [Enter]
  • Select the MobyLinuxVM machine and take a peek down the bottom at the “Status” panel, at the “Network” tab …

hyper-v-host

At around about this time, you’re probably starting to spam Google, and after an unspecified amount of digging may come across this question on StackOverflow. Here is a paraphrased and prettified version of the solution I posted there

The Solution

I ran into this exact same problem and none of the “popular” answers (like fixing DNS to 8.8.8.8) worked for me. I eventually happened across this link on the Docker GitHub forum, and that did the trick …

Between Docker for Windows, Windows 10 and Hyper-V, there seems to be a problem during the virtual network adapter creation process. Specifically, you might end up with two “vEthernet (DockerNAT)” network adapters. Check this (in an elevated PowerShell console) with …

   Get-NetAdapter "vEthernet (DockerNAT)"

If the result shows more than one adapter, you can disable and rename it with:

   $vmNetAdapter = Get-VMNetworkAdapter -ManagementOS -SwitchName DockerNAT
   Get-NetAdapter "vEthernet (DockerNAT)" | 
      ? { $_.DeviceID -ne $vmNetAdapter.DeviceID } | 
      Disable-NetAdapter -Confirm:$False -PassThru | 
      Rename-NetAdapter -NewName "OLD"

Then open up Device Manager ([Windows+R] → devmgmt.msc → [OK]) and delete the disabled adapter (for some reason you can do this from Device Manager, but not from the Network and Sharing Center adapters view).

All should now be well. Try docker run hello-world again to make sure.