for-win icon indicating copy to clipboard operation
for-win copied to clipboard

Two networks with name "nat"

Open JanneRantala opened this issue 8 years ago • 18 comments

Expected behavior

Docker would only have one default "nat" network

Actual behavior

Two "nat" networks exists, and neither can be used

Information

At some point when using Docker from Edge channel, the update process has managed to screw up networks Docker creates, and now I have two networks named "nat":

$ docker network ls NETWORK ID NAME DRIVER SCOPE 33fbf59fe519 DockerExternal transparent local e3c6cb5f70f9 Wifi transparent local 37a848736fb5 c1aed3e7578e8bf861dd7d34c190499ba378cff3cae50f81485e74e289073323 nat local a27389cafa30 nat nat local edecf92bee80 nat nat local 36ffac58f33a none null local

When I run for example docker-compose which has nat network defined in it, i'm getting error

ERROR: 2 matches found based on name: network nat is ambiguous

And if I try to remove one of those networks, I can't do that because of

Error response from daemon: nat is a pre-defined network and cannot be removed

  • Windows Version: Windows 10 Enterprise 1703
  • Docker for Windows Version: 18.03.0-ce-rc4-win57 (16511)
  • Diagnostics id: 7143158E-5CC1-4EAC-B0B4-591C12A47682/2018-03-22_12-56-52

Steps to reproduce the behavior

  1. This is a bit difficult to reproduce, something probably went wrong during DfW upgrade. And it ended up with two networks. Other needs to be removed, but don't know how.

JanneRantala avatar Mar 22 '18 11:03 JanneRantala

I'm experiencing this too after the latest Docker update

david-jarman avatar Mar 26 '18 17:03 david-jarman

Same problem here!

phorozan avatar Mar 27 '18 12:03 phorozan

I uninstalled Docker and reinstalled the previous version. That fixed the issue for me.

david-jarman avatar Mar 27 '18 20:03 david-jarman

I managed to address this issue by disabling the experimental features from the settings dialog and resetting the docker to factory settings.

phorozan avatar Mar 28 '18 00:03 phorozan

@phorozan Disabling experimental features and reseting to factory settings didn't help me.

JanneRantala avatar Mar 28 '18 05:03 JanneRantala

Same. Downgrading worked for me. https://docs.docker.com/docker-for-windows/release-notes/#docker-community-edition-17120-ce-win47-2018-01-12

TribeDataWorksJim avatar Apr 05 '18 13:04 TribeDataWorksJim

3c8a2dcba596 nat nat local 2057699b8f36 nat nat local

docker network rm 3c8a2dcba596 Error response from daemon: nat is a pre-defined network and cannot be removed

same here

bplasmeijer avatar May 01 '18 20:05 bplasmeijer

Same here. Error: 2 matches found based on name: network dockercompose... _default is ambiguous.

CyberBizSoft avatar May 02 '18 21:05 CyberBizSoft

I got the same after switching to LCOW. It's still there after resetting to factory defaults...

cocowalla avatar May 04 '18 12:05 cocowalla

Edit: I've been digging into other issues and came across this Microsoft article which outlines this exact issue and how to resolve it. I haven't tried it myself but I assume this will solve it for most people: https://docs.microsoft.com/en-us/virtualization/hyper-v-on-windows/user-guide/setup-nat-network#troubleshooting

Here's what I finally ended up doing to get around this (instead of just reverting back to an older build):

  1. Run docker network ls and observe two NAT networks
  2. Run Get-NetNat in Powershell and observe two NAT networks: Nat1 and Nat2
  3. Run Remove-NetNat -Name Nat2 to get rid of the second NAT network
  4. Reset docker to factory settings
  5. Run docker network ls and observe two networks with "DRIVER" set to nat, but this time, the name of the first one is a GUID, and running docker network rm <guid> succeeds, thus removing the second NAT network.

Mileage may vary, but this is what worked for me :)

david-jarman avatar May 07 '18 22:05 david-jarman

@david-jarman Thanks for linking to the appropriate solution. Those steps didn't exactly work but there is another section in the page which modifies the registry and fixes it.

abjrcode avatar May 17 '18 16:05 abjrcode

Same problem with Docker version 18.03.0-ce-win59, build 0520e24302 on Windows 10.

After uninstalling Docker, removing all Docker and .docker folders and then re-installing Docker, same issues:

  1. docker network ls shows 2 networks named nat
  2. I have a container (node-windows) raising this error: failed to build: network nat is ambiguous (2 matches found on name) at build step. Others containers work well.

Get-NetNat return an empty result on my computer.

I don't know how, when and why Docker created thoses two network named nat and I have no idea how to restore the situation.

Fredoid avatar May 18 '18 22:05 Fredoid

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

Fredoid avatar May 20 '18 21:05 Fredoid

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale comment. Stale issues will be closed after an additional 30d of inactivity.

Prevent issues from auto-closing with an /lifecycle frozen comment.

If this issue is safe to close now please do so.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. /lifecycle stale

docker-robott avatar Aug 18 '18 04:08 docker-robott

Same issue occured in Docker version 18.09.1, build 4c52b90, using Windows 10 pro

huangjj27 avatar Jan 27 '19 12:01 huangjj27

I finally worked for me by doing:

  • Deactivate Experimental features as suggested by @phorozan
  • Do Factory reset
  • The second nat changed its name image
  • so I was able to remove to with image

It is possible that it was luck because it was also the third time I did a factory reset .... maybe one should do factory reset until the second nat changes name

delcroip avatar May 22 '19 15:05 delcroip

On my PC windows 10 Pro I did the following and it worked:

 Stop service docker
 Stop service HNS
 Delete "C:\ProgramData\Microsoft\Windows\HNS\HNS.data"
 Delete "C:\ProgramData\docker\network\files\local-kv.db"
 Start service HNS
 Start docker

Then restart your computer and start docker service again.

alexluna1984 avatar Sep 16 '19 17:09 alexluna1984

Closed issues are locked after 30 days of inactivity. This helps our team focus on active issues.

If you have found a problem that seems similar to this, please open a new issue.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. /lifecycle locked

docker-robott avatar Jun 27 '20 03:06 docker-robott