Illep
Illep

Reputation: 16851

Hyper-V was unable to find a virtual switch with name "DockerNAT"

Why do I keep getting this error. It has been days now googling and trying to find a solution for this issue. I have no clue how to resolve this can someone please help me understand how to fix this ?

docker version:

Version 2.0.0.3 (31259) Channel: stable Build: 8858db3

Unable to create: The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Hyper-V was unable to find a virtual switch with name "DockerNAT".
at New-Switch, <No file>: line 121
at <ScriptBlock>, <No file>: line 411
   at Docker.Core.Pipe.NamedPipeClient.Send(String action, Object[] parameters) in C:\workspaces\stable-18.09.x\src\github.com\docker\pinata\win\src\Docker.Core\pipe\NamedPipeClient.cs:line 36
   at Docker.Actions.DoStart(SynchronizationContext syncCtx, Boolean showWelcomeWindow, Boolean executeAfterStartCleanup) in C:\workspaces\stable-18.09.x\src\github.com\docker\pinata\win\src\Docker.Windows\Actions.cs:line 92
   at Docker.Actions.<>c__DisplayClass19_0.<Start>b__0() in C:\workspaces\stable-18.09.x\src\github.com\docker\pinata\win\src\Docker.Windows\Actions.cs:line 74
   at Docker.WPF.TaskQueue.<>c__DisplayClass19_0.<.ctor>b__1() in C:\workspaces\stable-18.09.x\src\github.com\docker\pinata\win\src\Docker.WPF\TaskQueue.cs:line 59

Upvotes: 1

Views: 811

Answers (3)

Aaron
Aaron

Reputation: 23

I had the same issue, here is what worked for me:

  • Turn off the Hyper-V setting in Control Panel->Programs and Features ->"Turn Windows features on or off"
  • Restart computer
  • After computer has been restarted, your existing docker instance will detect that your Hyper-V setting is turned off and will ask you if you want to allow docker to enable the Hyper-V feature
  • Click "Yes" to allow docker to enable the Hyper-V feature on your machine
  • From there allow docker to start and do its thing

After doing these steps the error went away and my docker instance was working again.

Hope this solves your issue. Enjoy!

Upvotes: 0

selins sofa
selins sofa

Reputation: 91

After uninstalling and installing multiple times, despite 'Hyper-V' is enabled, I kept getting this error.

Running the MOFCOMP command and a reboot fixed this problem for me.

Running this command: (Command Prompt as administrator)

MOFCOMP %SYSTEMROOT%\System32\WindowsVirtualization.V2.mof

Then restart.

Upvotes: 0

RobertBaron
RobertBaron

Reputation: 2854

I also spent days trying to install and get Docker working correctly on Windows. It turned out that the company's antivirus had rules to block the creation of virtual switches. Also, uninstalling Docker left things behind which prevents a fresh install. Here is what I suggest doing:

  • Uninstall Docker.
  • Disable antivirus.
  • Make sure '%userprofile%.docker' does not exist.
  • Enable 'Container' and 'Hyper-V' in 'Turn Windows features on or off'.
  • Install Docker for Windows.

Upvotes: 1

Related Questions