none
docker network ls is showing 2 nat networks RRS feed

  • Question

  • Hi

    In Windows 2016 TP5, I can see 2 nat networks when running "docker network ls"

    > docker network ls
    NETWORK ID          NAME                DRIVER
    5b6f16b9deea        nat                 nat
    4de4abd1b2b7        nat                 nat
    5fb508a66334        none                null

    And I can't delete any of them (error: Error response from daemon: nat is a pre-defined network and cannot be removed)

    Having 2 nat networks is causing problems when starting the container: Error response from daemon: failed to create endpoint spread1 on network nat: network not found: 5b6f16b9deea6a59e0a9e0d1e6f783c4d04a0b80...

    when I inspect the container, I can see that the network id is 4de4abd1b2b704f29284287c9c1201c0635ca... 

    Any reason there are 2 nat networks? anything I can do to remove one of them?

    Friday, May 6, 2016 9:43 AM

All replies

  • I think for that, you can use the resolution of this thread: https://social.msdn.microsoft.com/Forums/en-US/3ddb2693-545c-48c3-a24a-9e21c5513782/trouble-collection-tp-5?forum=windowscontainers

    stop Docker (stop-service docker)

    go to programfiles\docker and open runDockerDaemon.cmd

    search for dockerd and add -b "none"

    save the file

    restart Docker with (start-service docker)

    try to remove nat with docker network rm nat.

    greetings Marcel

    Friday, May 6, 2016 10:32 AM
  • Thanks for the tip. I've tried adding -b "none" to the dockerd command, but I still can't remove any of the nat networks.

    And when I create a container, it still uses one of the nat networks rather than the none network

    Monday, May 9, 2016 8:06 AM
  • This is a known bug in TP5. We are working on a fix which will hopefully be available soon via a servicing update. In the meantime, please run the following script to clean-up:

    $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

    Restart the Computer

    Apologies for the inconvenience. After you clean-up, if you do want to create a user-defined NAT network, please stop the Docker daemon, add the '-b "none"' option and then restart the daemon. There should be no NAT networks listed when you run docker network ls. If there are (hopefully only one), please stop the Docker service again, run P/S cmdlet PS C:\> Get-ContainerNetwork | Remove-ContainerNetwork, restart the Docker service. create your nat network using docker network create

    • Proposed as answer by JMesser81 Thursday, June 2, 2016 3:44 PM
    Tuesday, May 17, 2016 5:44 PM