When I create a new ASP.NET Web Application in VS 15.6.4 with Docker Support enabled, I immediately get the following build error:
1>WebApplication3 -> c:\users\mulle\source\repos\WebApplication3\WebApplication3\bin\WebApplication3.dll
1>docker-compose -f "c:\users\mulle\source\repos\WebApplication3\docker-compose.yml" -f "c:\users\mulle\source\repos\WebApplication3\docker-compose.override.yml" -f "c:\users\mulle\source\repos\WebApplication3\obj\Docker\docker-compose.vs.debug.g.yml" -p dockercompose8443036482498000778 --no-ansi up -d --build --force-recreate --remove-orphans
1>2 matches found based on name: network nat is ambiguous
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(363,5): error : 2 matches found based on name: network nat is ambiguous.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(363,5): error :
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Sdks\Microsoft.Docker.Sdk\build\Microsoft.VisualStudio.Docker.Compose.targets(363,5): error : For more troubleshooting information, go to http://aka.ms/DockerToolsTroubleshooting
1>Done building project "docker-compose.dcproj" -- FAILED.
docker network ls produces the following output:
NETWORK ID NAME DRIVER SCOPE
5c2f84200f27 nat nat local
90484bbaf01b nat nat local
33131c23180b none null local
Both nat network cannot be removed because:
> docker network rm 5c2f84200f27
Error response from daemon: nat is a pre-defined network and cannot be removed
According to https://github.com/moby/moby/issues/20648#issuecomment-188215208 duplicate network names in Docker are by design. So this might be a bug.
Docker factory reset can be used as a workaround.
Factory reset still creates 2 nat driver networks for me, but with a unique name:
```
docker network ls
NETWORK ID NAME DRIVER SCOPE
c16d631fff32 3a58d72283c3b3da9debb8bb753d0327b1e15437dcb293e46bc1340b87a52290 nat local
fe93466d138c nat nat local
70d7f97915be none null local
````
The factory reset didn't work for me. I uninstalled Docker and then reinstalled. There were still two networks named nat. After uninstall, I had to remove all folders named Docker or .docker from Program Files, ProgramData, my profile etc. Then reinstall, and I had only one network named nat. Uninstalling Docker seems to leave a lot behind.
I'm also not sure if two nat networks is by design.
I have tried factory reset, reinstalling (and tried to find all occurrences of the folders), but am still having this issue.
You might try this network cleanup script. It has helped with similar issues in the past -> https://github.com/MicrosoftDocs/Virtualization-Documentation/tree/master/windows-server-container-tools/CleanupContainerHostNetworking
.\WindowsContainerNetworking-LoggingAndCleanupAide.ps1 -Cleanup
same here on (Version 18.05.0-ce-rc1-win63 (17439))
docker run --rm --platform linux busybox echo hello --network d9e5b31562b8
docker.exe: Error response from daemon: network nat is ambiguous (2 matches found on name).
docker network ls
NETWORK ID NAME DRIVER SCOPE
d9e5b31562b8 nat nat local
029ff73b534f nat nat local
8b14c3c19549 none null local
same for me with docker version 18.05.0-ce-rc1-win63 (17439). Any help or fixes in the queue?
same here with 18.03.1-ce-win65 (17513)
Tried uninstalling and reinstalling docker and Hyper-v and still have two nat's called nat.
I have the same problem:
Docker version 18.03.1-ce, build 9ee9f40
NETWORK ID NAME DRIVER SCOPE
0aa6fcfc5fc9 bridge bridge local
225fbdbda06e dockercompose7610429240741085608_default bridge local
1e6fca6d8459 dockercompose7610429240741085608_default bridge local
9784cadbee3a host host local
7cf1551affda none null local
2f20552ffff9 setup_default bridge local
two defaults with the same name
Same problem for me on a Windows 10 machine running Windows Containers. Not sure how or why Docker started listing two nat networks, but I was able to fix the problem by:
Hyper-V ManagerMobyLinuxVMAfter that, everything worked fine. Spent about two days on this. Hope this helps someone else!
Same probem with Docker version 18.03.1-ce, build 9ee9f40, Windows 10 and Windows Containers.
docker network ls shows 2 networks nat.
I've just found a solution in this topic
Simply run this following ps script to clean keys named "nat" and restart your computer.
$KeyPath = "HKLM:\SYSTEM\CurrentControlSet\Services\vmsmp\parameters\SwitchList"
$keys = get-childitem $KeyPath
foreach($key in $keys) {
if($key.GetValue("FriendlyName") -eq 'nat') {
$newKeyPath = $KeyPath+"\"+$key.PSChildName
Remove-Item -Path $newKeyPath -Recurse
}
}
remove-netnat -Confirm:$false
Works on Windows 10 Pro with Docker version 18.03.0-ce-win59, build 0520e24302.
Thanks
I am still having this issue. Those networks are not listed in the registry on my system. Also, in some writeups, they mention a PS command get get a list of networks, that command isn't recognized on my Windows 10 box
Hi, Sometimes it is mentioned Get-NetNat PS function, but in my case this function always return a empty result. The script above worked nice twice.
I my case this problem appeared when I unstalled and re-installed Docker. Two times, and same issue on both case.
Hi, i don't know which of this helped, but i've got rid of duplicate 'nat' networks as follows:
HNSC:\ProgramData\Microsoft\Windows\HNS\HNS.data"C:\ProgramData\docker\network\files\local-kv.db"Hope this will help.
That finally fixed my issue. I believe it was step 5 or 6 that done it! Thanks!!!
at finally fixed my issue. I believe it was step 5 or 6 that done it! Thanks!!!
Same here! My steps were
no pc restart required.
at finally fixed my issue. I believe it was step 5 or 6 that done it! Thanks!!!
Same here! My steps were
- Stop service docker
- Stop service HNS
- Delete "C:\ProgramData\Microsoft\WindowsHNSHNS.data"
- Delete "C:\ProgramData\docker\network\files\local-kv.db"
- Start service HNS
- Start docker
no pc restart required.
Worked for me!
Thank you.
I've just found a solution in this topic
Simply run this following ps script to clean keys named "nat" and restart your computer.
$KeyPath = "HKLM:\SYSTEM\CurrentControlSet\Services\vmsmp\parameters\SwitchList" $keys = get-childitem $KeyPath foreach($key in $keys) { if($key.GetValue("FriendlyName") -eq 'nat') { $newKeyPath = $KeyPath+"\"+$key.PSChildName Remove-Item -Path $newKeyPath -Recurse } } remove-netnat -Confirm:$falseWorks on Windows 10 Pro with Docker version 18.03.0-ce-win59, build 0520e24302.
Thanks
tried this and it fixed my issue after restart. running on windows 10.
I have the same issue on a testing machine. When running e2e tests, we will uninstall and install docker (moby) and this issue happens randomly. I would like to ask, does anyone know what the root cause is.
These steps worked for me on Windows 10 -
Delete "C:\ProgramData\Microsoft\WindowsHNSHNS.data"
Delete "C:\ProgramData\docker\network\files\local-kv.db"
The way I solved this is by listing the networks
docker network ls as @Fredoid mentioned you'll see a duplicated network as the error indicated,
then use the id of the network causing the error to remove it
docker network rm NETWORK_ID
at finally fixed my issue. I believe it was step 5 or 6 that done it! Thanks!!!
Same here! My steps were
- Stop service docker
- Stop service HNS
- Delete "C:\ProgramData\Microsoft\WindowsHNSHNS.data"
- Delete "C:\ProgramData\docker\network\files\local-kv.db"
- Start service HNS
- Start docker
no pc restart required.
Worked for me as well. Thanks.
Most helpful comment
Same here! My steps were
no pc restart required.