Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

I updated my docker for desktop app (Version 2.0.0.3) on Windows 10 pro.But since then my docker is not starting and throwing following error.

Hyper-V\Get-VMNetworkAdapter : Hyper-V was unable to find a virtual switch with name "DockerNAT".
At C:\Program Files\Docker\Docker\resources\MobyLinux.ps1:121 char:25
+ ... etAdapter = Hyper-V\Get-VMNetworkAdapter -ManagementOS -SwitchName $S ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (DockerNAT:String) [Get-VMNetworkAdapter], VirtualizationException
    + FullyQualifiedErrorId : InvalidParameter,Microsoft.HyperV.PowerShell.Commands.GetVMNetworkAdapter

I followed the steps mentioned in the link (Docker on windows 10 can't startup after deleting MobyLinuxVM in Hyper-V manually ) , but it did not fix the issue. enter image description here I have also tried disabling --> restarting --> and then enabling Hyper V and containers option using "Turn windows feature on or off" present at "Control Panel\Programs\Programs and Features"

My network connection has following information enter image description here

But still I am not being able to start my windows Docker app, which keeps throwing

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
like image 305
sumit kumar Avatar asked Feb 19 '19 09:02

sumit kumar


2 Answers

I also faced this issue once.

I tried several workarounds but nothing worked. The issue was that the MobyLinuxVM could not create the Docker NAT switch, as a result Docker service could not be started.

The working solution was to reset my network settings. I cannot remember if I had to remove all network related entries in Computer Management in order to be re-initialized from scratch.

Important: You will lose all user defined network-related settings. Try it if everything else fails.

Edit: Another thing you can try is to restart the Hyper-V management service by executing the following commands in an admin shell:

net stop vmms
net start vmms

Found in related github issue

like image 84
leopal Avatar answered Oct 30 '22 19:10

leopal


open the hyper-v manger and check in the "Virtual switch manager" if you can see the DockerNAT there or not , Docker for windows created this switch when it starts before creating the mobylinux vm. if your powershell script is not creating this switch ten try to create it directly there .

enter image description here

like image 27
Nadeem Hussain Avatar answered Oct 30 '22 18:10

Nadeem Hussain