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

Cannot change default NAT IP address/HNS failed with error:The object already exists

Open JanneRantala opened this issue 9 years ago • 20 comments

Expected behavior

Docker should start and create NAT network with given IP when "fixed-cidr":"192.168.100.0/16" is defined.

Actual behavior

Docker fails to start with error:

Docker daemon failed with message: Error starting daemon: Error initializing network controller: Error creating default network: HNS failed with error : The object already exists.

at Docker.Backend.ContainerEngine.Windows.DoStart(Settings settings) in C:\gopath\src\github.com\docker\pinata\win\src\Docker.Backend\ContainerEngine\Windows.cs:line 193 at Docker.Backend.ContainerEngine.Windows.Restart(Settings settings) in C:\gopath\src\github.com\docker\pinata\win\src\Docker.Backend\ContainerEngine\Windows.cs:line 131 at Docker.Core.Pipe.NamedPipeServer.<>c__DisplayClass8_0.b__0(Object[] parameters) in C:\gopath\src\github.com\docker\pinata\win\src\Docker.Core\pipe\NamedPipeServer.cs:line 44 at Docker.Core.Pipe.NamedPipeServer.RunAction(String action, Object[] parameters) in C:\gopath\src\github.com\docker\pinata\win\src\Docker.Core\pipe\NamedPipeServer.cs:line 140

Information

  • Diagnostic ID: 7143158E-5CC1-4EAC-B0B4-591C12A47682/2017-05-10_09-30-23
  • OS Name: Microsoft Windows 10 Enterprise
  • OS Version: 10.0.14393 N/A Build 14393

Steps to reproduce the behavior

  1. Install latest Docker Edge version 17.05.0-ce-win9 (11965)
  2. Set "fixed-cidr":"192.168.100.0/16" to daemon settings in Docker UI.
  3. Shutdown Docker, remove existing container network get-containernetwork | remove-containernetwork
  4. Restart Docker and the error should appear.

JanneRantala avatar May 10 '17 06:05 JanneRantala

I've had a similar exception with upgraded WS2016 and also on W10 when using fixed-cdr option, I think the ip range was in use and docker couldn't bind to it or something... Using other (small) range in W10 resolved it. Maybe this helps...

biiiipy avatar May 16 '17 11:05 biiiipy

@biiiipy unfortunately I've tried all kinds of combinations but all of them give me the same exception. So the only way I'm able to start Docker for Windows is when I'm not defining fixed-cidr at all. I'm also having this issue on Windows Server 2016 which Microsoft has tried solving for more than a month no without any success. Thanks anyways.

JanneRantala avatar May 16 '17 12:05 JanneRantala

I am having the same issue also with the latest EDGE release. Here is the output and it doesnt seem to mater what I put in for fixed-cidr.

my current daemon.json


{
  "debug": true,
  "experimental": true,
  "fixed-cidr" : "192.168.128.0/24"
}

The output when i try and start the daemon


C:\Program Files\Docker\Docker\resources>dockerd.exe
time="2017-05-19T09:57:43-05:00" level=warning msg="Running experimental build"
time="2017-05-19T09:57:43.397363100-05:00" level=debug msg="Listener created for HTTP on npipe (//./pipe/docker_engine)"

time="2017-05-19T09:57:43.400362700-05:00" level=info msg="Windows default isolation mode: hyperv"
time="2017-05-19T09:57:43.400362700-05:00" level=debug msg="Using default logging driver json-file"
time="2017-05-19T09:57:43.400362700-05:00" level=debug msg="Stackdump - waiting signal at Global\\docker-daemon-106588"
time="2017-05-19T09:57:43.401362400-05:00" level=debug msg="WindowsGraphDriver InitFilter at C:\\ProgramData\\Docker\\wi
ndowsfilter"
time="2017-05-19T09:57:43.401862100-05:00" level=info msg="[graphdriver] using prior storage driver: windowsfilter"
time="2017-05-19T09:57:43.401862100-05:00" level=debug msg="Using graph driver windowsfilter"
time="2017-05-19T09:57:43.408369900-05:00" level=debug msg="Max Concurrent Downloads: 3"
time="2017-05-19T09:57:43.408369900-05:00" level=debug msg="Max Concurrent Uploads: 5"
time="2017-05-19T09:57:43.437860000-05:00" level=info msg="Graph migration to content-addressability took 0.00 seconds"
time="2017-05-19T09:57:43.438859700-05:00" level=info msg="Loading containers: start."
time="2017-05-19T09:57:43.439860200-05:00" level=debug msg="Loaded container bd6755e69b5e4405cb2b8c66dd00a75c450811cc008
29f0e72b12cb57fcf3809"
time="2017-05-19T09:57:43.456861100-05:00" level=debug msg="Option Experimental: true"
time="2017-05-19T09:57:43.456861100-05:00" level=debug msg="Option DefaultDriver: nat"
time="2017-05-19T09:57:43.457370500-05:00" level=debug msg="Option DefaultNetwork: nat"
time="2017-05-19T09:57:43.457370500-05:00" level=info msg="Restoring existing overlay networks from HNS into docker"
time="2017-05-19T09:57:43.464360400-05:00" level=debug msg="Network Response : [  ]"
time="2017-05-19T09:57:43.509359500-05:00" level=debug msg="Network Response : [  ]"
time="2017-05-19T09:57:43.521359600-05:00" level=debug msg="Launching DNS server for network%!(EXTRA string=none)"
time="2017-05-19T09:57:43.543862700-05:00" level=debug msg="Allocating IPv4 pools for network nat (0a5a8a421fc78a132d565
901d62e686357d5c73feaa5b8d5dd0c1bdaf2975a5c)"
time="2017-05-19T09:57:43.544392600-05:00" level=debug msg="RequestPool(LocalDefault, 192.168.128.0/24, , map[], false)"

time="2017-05-19T09:57:43.544876100-05:00" level=debug msg="RequestAddress(192.168.128.0/24, <nil>, map[RequestAddressTy
pe:com.docker.network.gateway])"
time="2017-05-19T09:57:43.544876100-05:00" level=debug msg="HNSNetwork Request ={\"Name\":\"nat\",\"Type\":\"nat\",\"Sub
nets\":[{\"AddressPrefix\":\"192.168.128.0/24\",\"GatewayAddress\":\"192.168.128.0\"}]} Address Space=[{192.168.128.0/24
 192.168.128.0 []}]"
time="2017-05-19T09:57:44.105442900-05:00" level=debug msg="releasing IPv4 pools from network nat (0a5a8a421fc78a132d565
901d62e686357d5c73feaa5b8d5dd0c1bdaf2975a5c)"
time="2017-05-19T09:57:44.105942600-05:00" level=debug msg="ReleaseAddress(192.168.128.0/24, 192.168.128.0)"
time="2017-05-19T09:57:44.105942600-05:00" level=debug msg="ReleasePool(192.168.128.0/24)"
time="2017-05-19T09:57:44.106442300-05:00" level=debug msg="start clean shutdown of all containers with a 15 seconds tim
eout..."
Error starting daemon: Error initializing network controller: Error creating default network: HNS failed with error : Th
e object already exists.

I have also tried the following and deleting the HNS.data file at C:\ProgramData\Microsoft\Windows\HNS

PS C:\WINDOWS\system32> stop-service com.docker.service
PS C:\WINDOWS\system32> stop-service hns
PS C:\WINDOWS\system32> Get-ContainerNetwork | Remove-ContainerNetwork

Confirm
Remove-ContainerNetwork will remove the container network "".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):
PS C:\WINDOWS\system32> Get-NetNat | Remove-NetNat
PS C:\WINDOWS\system32> stop-service hns
PS C:\WINDOWS\system32> stop-service hns
PS C:\WINDOWS\system32> stop-service com.docker.service
PS C:\WINDOWS\system32> Get-ContainerNetwork | Remove-ContainerNetwork
PS C:\WINDOWS\system32> Get-NetNat | Remove-NetNat
PS C:\WINDOWS\system32> stop-service hns

mechanic22 avatar May 19 '17 15:05 mechanic22

Some other things i have tried were starting dockerd with "bridge": "none" so it doesn't create the default NAT network which was successful

Bu then I tried to create a nat network manually using docker commands and that failed with the same error

daemon.json

{
  "debug": true,
  "experimental": true,
   "bridge": "none"
}
PS C:\WINDOWS\system32> stop-service com.docker.service
PS C:\WINDOWS\system32> stop-service hns
PS C:\WINDOWS\system32> del 'C:\ProgramData\Microsoft\Windows\HNS\HNS.data'
PS C:\WINDOWS\system32> Get-ContainerNetwork | Remove-ContainerNetwork
PS C:\WINDOWS\system32> Get-NetNat | Remove-NetNat
PS C:\WINDOWS\system32> start-service hns
PS C:\WINDOWS\system32> start-service com.docker.service
PS C:\WINDOWS\system32> docker network create -d nat --subnet=192.168.1.0/24 mynat
Error response from daemon: HNS failed with error : The object already exists.

Output from dockerd.exe

time="2017-05-19T10:10:08-05:00" level=warning msg="Running experimental build"
time="2017-05-19T10:10:08.206695200-05:00" level=debug msg="Listener created for HTTP on npipe (//./pipe/docker_engine)"

time="2017-05-19T10:10:08.209195400-05:00" level=warning msg="failed to rename C:\\ProgramData\\Docker\\tmp for backgrou
nd deletion: %!s(<nil>). Deleting synchronously"
time="2017-05-19T10:10:08.210195100-05:00" level=info msg="Windows default isolation mode: hyperv"
time="2017-05-19T10:10:08.210195100-05:00" level=debug msg="Using default logging driver json-file"
time="2017-05-19T10:10:08.210195100-05:00" level=debug msg="Stackdump - waiting signal at Global\\docker-daemon-115676"
time="2017-05-19T10:10:08.211195100-05:00" level=debug msg="WindowsGraphDriver InitFilter at C:\\ProgramData\\Docker\\wi
ndowsfilter"
time="2017-05-19T10:10:08.211732300-05:00" level=info msg="[graphdriver] using prior storage driver: windowsfilter"
time="2017-05-19T10:10:08.212205600-05:00" level=debug msg="Using graph driver windowsfilter"
time="2017-05-19T10:10:08.218194400-05:00" level=debug msg="Max Concurrent Downloads: 3"
time="2017-05-19T10:10:08.218706400-05:00" level=debug msg="Max Concurrent Uploads: 5"
time="2017-05-19T10:10:08.234705500-05:00" level=info msg="Graph migration to content-addressability took 0.00 seconds"
time="2017-05-19T10:10:08.235212800-05:00" level=info msg="Loading containers: start."
time="2017-05-19T10:10:08.236194600-05:00" level=debug msg="Loaded container bd6755e69b5e4405cb2b8c66dd00a75c450811cc008
29f0e72b12cb57fcf3809"
time="2017-05-19T10:10:08.245264200-05:00" level=debug msg="Option Experimental: true"
time="2017-05-19T10:10:08.245264200-05:00" level=debug msg="Option DefaultDriver: nat"
time="2017-05-19T10:10:08.245773300-05:00" level=debug msg="Option DefaultNetwork: nat"
time="2017-05-19T10:10:08.246253100-05:00" level=info msg="Restoring existing overlay networks from HNS into docker"
time="2017-05-19T10:10:08.255253800-05:00" level=debug msg="Network Response : [  ]"
time="2017-05-19T10:10:08.295758300-05:00" level=debug msg="Network Response : [  ]"
time="2017-05-19T10:10:08.306763700-05:00" level=debug msg="Launching DNS server for network%!(EXTRA string=none)"
time="2017-05-19T10:10:08.320264600-05:00" level=info msg="Loading containers: done."
time="2017-05-19T10:10:08.333763700-05:00" level=info msg="Daemon has completed initialization"
time="2017-05-19T10:10:08.334255800-05:00" level=info msg="Docker daemon" commit=89658be graphdriver=windowsfilter versi
on=17.05.0-ce
time="2017-05-19T10:10:08.334755200-05:00" level=debug msg="Registering routers"
time="2017-05-19T10:10:08.334755200-05:00" level=debug msg="Registering GET, /containers/{name:.*}/checkpoints"
time="2017-05-19T10:10:08.335256100-05:00" level=debug msg="Registering POST, /containers/{name:.*}/checkpoints"
time="2017-05-19T10:10:08.335256100-05:00" level=debug msg="Registering DELETE, /containers/{name}/checkpoints/{checkpoi
nt}"
time="2017-05-19T10:10:08.335764000-05:00" level=debug msg="Registering HEAD, /containers/{name:.*}/archive"
time="2017-05-19T10:10:08.336254600-05:00" level=debug msg="Registering GET, /containers/json"
time="2017-05-19T10:10:08.336753100-05:00" level=debug msg="Registering GET, /containers/{name:.*}/export"
time="2017-05-19T10:10:08.337280700-05:00" level=debug msg="Registering GET, /containers/{name:.*}/changes"
time="2017-05-19T10:10:08.337781800-05:00" level=debug msg="Registering GET, /containers/{name:.*}/json"
time="2017-05-19T10:10:08.338263900-05:00" level=debug msg="Registering GET, /containers/{name:.*}/top"
time="2017-05-19T10:10:08.338263900-05:00" level=debug msg="Registering GET, /containers/{name:.*}/logs"
time="2017-05-19T10:10:08.338756300-05:00" level=debug msg="Registering GET, /containers/{name:.*}/stats"
time="2017-05-19T10:10:08.339253900-05:00" level=debug msg="Registering GET, /containers/{name:.*}/attach/ws"
time="2017-05-19T10:10:08.339756600-05:00" level=debug msg="Registering GET, /exec/{id:.*}/json"
time="2017-05-19T10:10:08.340256900-05:00" level=debug msg="Registering GET, /containers/{name:.*}/archive"
time="2017-05-19T10:10:08.340256900-05:00" level=debug msg="Registering POST, /containers/create"
time="2017-05-19T10:10:08.340775600-05:00" level=debug msg="Registering POST, /containers/{name:.*}/kill"
time="2017-05-19T10:10:08.341272700-05:00" level=debug msg="Registering POST, /containers/{name:.*}/pause"
time="2017-05-19T10:10:08.341272700-05:00" level=debug msg="Registering POST, /containers/{name:.*}/unpause"
time="2017-05-19T10:10:08.341785300-05:00" level=debug msg="Registering POST, /containers/{name:.*}/restart"
time="2017-05-19T10:10:08.342277600-05:00" level=debug msg="Registering POST, /containers/{name:.*}/start"
time="2017-05-19T10:10:08.342277600-05:00" level=debug msg="Registering POST, /containers/{name:.*}/stop"
time="2017-05-19T10:10:08.342786100-05:00" level=debug msg="Registering POST, /containers/{name:.*}/wait"
time="2017-05-19T10:10:08.343289400-05:00" level=debug msg="Registering POST, /containers/{name:.*}/resize"
time="2017-05-19T10:10:08.343289400-05:00" level=debug msg="Registering POST, /containers/{name:.*}/attach"
time="2017-05-19T10:10:08.343786400-05:00" level=debug msg="Registering POST, /containers/{name:.*}/copy"
time="2017-05-19T10:10:08.344278500-05:00" level=debug msg="Registering POST, /containers/{name:.*}/exec"
time="2017-05-19T10:10:08.344655600-05:00" level=debug msg="Registering POST, /exec/{name:.*}/start"
time="2017-05-19T10:10:08.344756200-05:00" level=debug msg="Registering POST, /exec/{name:.*}/resize"
time="2017-05-19T10:10:08.345262900-05:00" level=debug msg="Registering POST, /containers/{name:.*}/rename"
time="2017-05-19T10:10:08.345262900-05:00" level=debug msg="Registering POST, /containers/{name:.*}/update"
time="2017-05-19T10:10:08.345789300-05:00" level=debug msg="Registering POST, /containers/prune"
time="2017-05-19T10:10:08.346279300-05:00" level=debug msg="Registering PUT, /containers/{name:.*}/archive"
time="2017-05-19T10:10:08.346778400-05:00" level=debug msg="Registering DELETE, /containers/{name:.*}"
time="2017-05-19T10:10:08.346778400-05:00" level=debug msg="Registering GET, /images/json"
time="2017-05-19T10:10:08.347383100-05:00" level=debug msg="Registering GET, /images/search"
time="2017-05-19T10:10:08.347383100-05:00" level=debug msg="Registering GET, /images/get"
time="2017-05-19T10:10:08.347889600-05:00" level=debug msg="Registering GET, /images/{name:.*}/get"
time="2017-05-19T10:10:08.348388700-05:00" level=debug msg="Registering GET, /images/{name:.*}/history"
time="2017-05-19T10:10:08.348388700-05:00" level=debug msg="Registering GET, /images/{name:.*}/json"
time="2017-05-19T10:10:08.348891900-05:00" level=debug msg="Registering POST, /commit"
time="2017-05-19T10:10:08.349387800-05:00" level=debug msg="Registering POST, /images/load"
time="2017-05-19T10:10:08.349387800-05:00" level=debug msg="Registering POST, /images/create"
time="2017-05-19T10:10:08.349888600-05:00" level=debug msg="Registering POST, /images/{name:.*}/push"
time="2017-05-19T10:10:08.350387500-05:00" level=debug msg="Registering POST, /images/{name:.*}/tag"
time="2017-05-19T10:10:08.350387500-05:00" level=debug msg="Registering POST, /images/prune"
time="2017-05-19T10:10:08.350898000-05:00" level=debug msg="Registering DELETE, /images/{name:.*}"
time="2017-05-19T10:10:08.350898000-05:00" level=debug msg="Registering OPTIONS, /{anyroute:.*}"
time="2017-05-19T10:10:08.351389800-05:00" level=debug msg="Registering GET, /_ping"
time="2017-05-19T10:10:08.351389800-05:00" level=debug msg="Registering GET, /events"
time="2017-05-19T10:10:08.351389800-05:00" level=debug msg="Registering GET, /info"
time="2017-05-19T10:10:08.351889800-05:00" level=debug msg="Registering GET, /version"
time="2017-05-19T10:10:08.351889800-05:00" level=debug msg="Registering GET, /system/df"
time="2017-05-19T10:10:08.352395300-05:00" level=debug msg="Registering POST, /auth"
time="2017-05-19T10:10:08.352889500-05:00" level=debug msg="Registering GET, /volumes"
time="2017-05-19T10:10:08.353400600-05:00" level=debug msg="Registering GET, /volumes/{name:.*}"
time="2017-05-19T10:10:08.353890000-05:00" level=debug msg="Registering POST, /volumes/create"
time="2017-05-19T10:10:08.353890000-05:00" level=debug msg="Registering POST, /volumes/prune"
time="2017-05-19T10:10:08.354388600-05:00" level=debug msg="Registering DELETE, /volumes/{name:.*}"
time="2017-05-19T10:10:08.354388600-05:00" level=debug msg="Registering POST, /build"
time="2017-05-19T10:10:08.354889700-05:00" level=debug msg="Registering POST, /swarm/init"
time="2017-05-19T10:10:08.354889700-05:00" level=debug msg="Registering POST, /swarm/join"
time="2017-05-19T10:10:08.354889700-05:00" level=debug msg="Registering POST, /swarm/leave"
time="2017-05-19T10:10:08.355389700-05:00" level=debug msg="Registering GET, /swarm"
time="2017-05-19T10:10:08.355389700-05:00" level=debug msg="Registering GET, /swarm/unlockkey"
time="2017-05-19T10:10:08.355889400-05:00" level=debug msg="Registering POST, /swarm/update"
time="2017-05-19T10:10:08.356389100-05:00" level=debug msg="Registering POST, /swarm/unlock"
time="2017-05-19T10:10:08.356389100-05:00" level=debug msg="Registering GET, /services"
time="2017-05-19T10:10:08.356389100-05:00" level=debug msg="Registering GET, /services/{id}"
time="2017-05-19T10:10:08.356889700-05:00" level=debug msg="Registering POST, /services/create"
time="2017-05-19T10:10:08.357389400-05:00" level=debug msg="Registering POST, /services/{id}/update"
time="2017-05-19T10:10:08.357389400-05:00" level=debug msg="Registering DELETE, /services/{id}"
time="2017-05-19T10:10:08.357887600-05:00" level=debug msg="Registering GET, /services/{id}/logs"
time="2017-05-19T10:10:08.358386100-05:00" level=debug msg="Registering GET, /nodes"
time="2017-05-19T10:10:08.358386100-05:00" level=debug msg="Registering GET, /nodes/{id}"
time="2017-05-19T10:10:08.358886700-05:00" level=debug msg="Registering DELETE, /nodes/{id}"
time="2017-05-19T10:10:08.359390200-05:00" level=debug msg="Registering POST, /nodes/{id}/update"
time="2017-05-19T10:10:08.359889900-05:00" level=debug msg="Registering GET, /tasks"
time="2017-05-19T10:10:08.360390200-05:00" level=debug msg="Registering GET, /tasks/{id}"
time="2017-05-19T10:10:08.360390200-05:00" level=debug msg="Registering GET, /tasks/{id}/logs"
time="2017-05-19T10:10:08.360886100-05:00" level=debug msg="Registering GET, /secrets"
time="2017-05-19T10:10:08.360886100-05:00" level=debug msg="Registering POST, /secrets/create"
time="2017-05-19T10:10:08.361886900-05:00" level=debug msg="Registering DELETE, /secrets/{id}"
time="2017-05-19T10:10:08.362388700-05:00" level=debug msg="Registering GET, /secrets/{id}"
time="2017-05-19T10:10:08.362886000-05:00" level=debug msg="Registering POST, /secrets/{id}/update"
time="2017-05-19T10:10:08.363389800-05:00" level=debug msg="Registering GET, /plugins"
time="2017-05-19T10:10:08.363389800-05:00" level=debug msg="Registering GET, /plugins/{name:.*}/json"
time="2017-05-19T10:10:08.364398600-05:00" level=debug msg="Registering GET, /plugins/privileges"
time="2017-05-19T10:10:08.364398600-05:00" level=debug msg="Registering DELETE, /plugins/{name:.*}"
time="2017-05-19T10:10:08.364886000-05:00" level=debug msg="Registering POST, /plugins/{name:.*}/enable"
time="2017-05-19T10:10:08.365405900-05:00" level=debug msg="Registering POST, /plugins/{name:.*}/disable"
time="2017-05-19T10:10:08.365405900-05:00" level=debug msg="Registering POST, /plugins/pull"
time="2017-05-19T10:10:08.365888000-05:00" level=debug msg="Registering POST, /plugins/{name:.*}/push"
time="2017-05-19T10:10:08.366387700-05:00" level=debug msg="Registering POST, /plugins/{name:.*}/upgrade"
time="2017-05-19T10:10:08.366892700-05:00" level=debug msg="Registering POST, /plugins/{name:.*}/set"
time="2017-05-19T10:10:08.367192700-05:00" level=debug msg="Registering POST, /plugins/create"
time="2017-05-19T10:10:08.367375400-05:00" level=debug msg="Registering GET, /networks"
time="2017-05-19T10:10:08.367879200-05:00" level=debug msg="Registering GET, /networks/"
time="2017-05-19T10:10:08.367879200-05:00" level=debug msg="Registering GET, /networks/{id:.+}"
time="2017-05-19T10:10:08.368378300-05:00" level=debug msg="Registering POST, /networks/create"
time="2017-05-19T10:10:08.368878900-05:00" level=debug msg="Registering POST, /networks/{id:.*}/connect"
time="2017-05-19T10:10:08.368878900-05:00" level=debug msg="Registering POST, /networks/{id:.*}/disconnect"
time="2017-05-19T10:10:08.369381500-05:00" level=debug msg="Registering POST, /networks/prune"
time="2017-05-19T10:10:08.369895900-05:00" level=debug msg="Registering DELETE, /networks/{id:.*}"
time="2017-05-19T10:10:08.370378900-05:00" level=info msg="API listen on //./pipe/docker_engine"
time="2017-05-19T10:10:08.370378900-05:00" level=debug msg="Config reload - waiting signal at Global\\docker-daemon-conf
ig-115676"
time="2017-05-19T10:10:24.036185800-05:00" level=debug msg="Calling GET /_ping"
time="2017-05-19T10:10:24.039174300-05:00" level=debug msg="Calling POST /v1.29/networks/create"
time="2017-05-19T10:10:24.039673700-05:00" level=debug msg="form data: {\"Attachable\":false,\"CheckDuplicate\":true,\"D
river\":\"nat\",\"EnableIPv6\":false,\"IPAM\":{\"Config\":[{\"Subnet\":\"192.168.1.0/24\"}],\"Driver\":\"default\",\"Opt
ions\":{}},\"Ingress\":false,\"Internal\":false,\"Labels\":{},\"Name\":\"mynat\",\"Options\":{}}"
time="2017-05-19T10:10:24.049176200-05:00" level=debug msg="Allocating IPv4 pools for network mynat (62cd9bd8808536faef2
ade588e390801d58007434750a60f62c3822d4fac23f2)"
time="2017-05-19T10:10:24.049673800-05:00" level=debug msg="RequestPool(LocalDefault, 192.168.1.0/24, , map[], false)"
time="2017-05-19T10:10:24.049673800-05:00" level=debug msg="RequestAddress(192.168.1.0/24, <nil>, map[RequestAddressType
:com.docker.network.gateway])"
time="2017-05-19T10:10:24.050191100-05:00" level=debug msg="HNSNetwork Request ={\"Name\":\"62cd9bd8808536faef2ade588e39
0801d58007434750a60f62c3822d4fac23f2\",\"Type\":\"nat\",\"Subnets\":[{\"AddressPrefix\":\"192.168.1.0/24\",\"GatewayAddr
ess\":\"192.168.1.0\"}]} Address Space=[{192.168.1.0/24 192.168.1.0 []}]"
time="2017-05-19T10:10:24.580655500-05:00" level=debug msg="releasing IPv4 pools from network mynat (62cd9bd8808536faef2
ade588e390801d58007434750a60f62c3822d4fac23f2)"
time="2017-05-19T10:10:24.580655500-05:00" level=debug msg="ReleaseAddress(192.168.1.0/24, 192.168.1.0)"
time="2017-05-19T10:10:24.581154900-05:00" level=debug msg="ReleasePool(192.168.1.0/24)"
time="2017-05-19T10:10:24.581154900-05:00" level=error msg="Handler for POST /v1.29/networks/create returned error: HNS
failed with error : The object already exists. "

mechanic22 avatar May 19 '17 15:05 mechanic22

FYI I was able to create a NAT when "bridge": "none" was in daemon.json by using the following command

PS C:\WINDOWS\system32> docker network create -d nat --subnet=192.168.1.0/24 --gateway=192.168.1.1 mynat
d0d31ecf39ec6cada948c3158b176e9a67d7e0ba6458208d9c91b240587c0763
PS C:\WINDOWS\system32> docker network ls
NETWORK ID          NAME                DRIVER              SCOPE
d0d31ecf39ec        mynat               nat                 local
ff85254d559d        none                null                local

One thing to note though, once this was done for some reason (maybe unrelated) most docker commands had to be executed from an elevated command window

mechanic22 avatar May 19 '17 15:05 mechanic22

@mechanic22 yeah, that works, thanks. I'd still like to be able to use default nat network. Hey @friism, any ideas what might be causing this?

JanneRantala avatar May 22 '17 10:05 JanneRantala

Could somebody give some kind of comment to this? Is somebody working on this?

JanneRantala avatar Jun 15 '17 10:06 JanneRantala

This works if you downgrade compose version to 2.1 but would not work with compose version 3+ Compose file below works as expected, that is creating network and assigning static IP address

version: '2.1'
services:
   test:
      image: artisticcheese/cpuconsume:latest
      environment: 
        - "SHELL=powershell.exe"
      networks:
        my_network:
          ipv4_address: 172.16.238.10
networks:
  my_network:
    ipam:
      driver: default
      config:
        -
          subnet: 172.16.238.0/24
          gateway: 172.16.238.1

artisticcheese avatar Jul 22 '17 00:07 artisticcheese

I'd just like to add my 2p's worth here, i'm getting the same error as the original poster. If you remove the fixed CIDR from the daemon configuration file, then restart, then add the fixed cidr back in, the daemon will start correctly. This is my config file. { "registry-mirrors": [], "insecure-registries": [], "debug": true, "fixed-cidr": "192.168.10.0/24", "experimental": true }

This using the latest stable build on windows 10.

RobinHoody avatar Jul 24 '17 08:07 RobinHoody

@RobinHoody But does it really create network with that 192.168.10.0 prefix? I think you'd have to first remove current nat network after changing daemon.json and then try restarting Docker, and that's where my luck ends.

JanneRantala avatar Aug 21 '17 11:08 JanneRantala

@JanneRantala you are indeed correct, you do have to delete the existing network and restart docker.

RobinHoody avatar Aug 24 '17 10:08 RobinHoody

I just got this working on Win 2016 with these steps:

  1. Stop docker
  2. Create daemon.json like this:
{
   "bridge": "none"
}
  1. Remove default nat network using command:
Get-ContainerNetwork | Remove-ContainerNetwork
  1. Start docker
  2. Create new nat network using command (notice that you need use some other network name than "nat")
docker network create --driver nat --subnet 172.16.200.0/24 --gateway 172.16.200.1 newnat
  1. Stop docker
  2. Remove daemon.json
  3. Start docker again
  4. Use compose file like this:
services:
  test:
    image: something
    networks:
      default:
        ipv4_address: 172.16.200.11
networks:
  default:
    external:
      name: nat

Steps 6-8 are needed to get option "com.docker.network.windowsshim.networkname" value to "nat" (on docker network inspect nat ). Without them you can see newnat on its value and connecting containers to network does not work.

olljanat avatar Sep 19 '17 09:09 olljanat

@olljanat Tried the same with Windows 10 but in step 8 starting Docker caused this

fatal: Error starting daemon: Error initializing network controller: Error creating default network: HNS failed with error : The parameter is incorrect.

JanneRantala avatar Sep 20 '17 12:09 JanneRantala

What do you get from: "Get-NetNat" and "New-NetNAT -name nat -InternalIPInterfaceAddressPrefix 172.16.200.1/20"?

hitechhayekian avatar Feb 28 '18 15:02 hitechhayekian

@danilotg I'll have to try the next time I'm having this issue, which usually means in the next few days. It's unbelievable that these problems still exist, I'm this same "object already exists" in different 2016 Servers on a weekly basis when trying to start container(s). @jasonbivins or @kallie-b, is this issue even on a radar or am I hoping too much?

JanneRantala avatar Mar 05 '18 20:03 JanneRantala

Hi @JanneRantala sorry to hear you're having these problems... What command did you use to restart Docker in step 8 that @olljanat posted? Did you try running Docker in debug mode (dockerd - D) to see any error messages?

daschott avatar Mar 06 '18 00:03 daschott

@JanneRantala the 'fixed-cidr not working on Windows issue' was recently fixed but has not yet been released for Docker EE. See here. Still waiting patiently for the next EE release...

jorisscheppers avatar Mar 06 '18 08:03 jorisscheppers

FYI. We solved this issue on our environment by installing to Docker to clean 2016 servers on two phases:

  • Install Containers Windows feature and restart
  • Install Docker EE
  • Updated dockerd.exe start command from Windows registry to contain --fixed-cidr parameter before start it first time.

Edit: FYI. I also started to keep track of known issues / workaround on Linux + Windows hybrid Docker Swarm usage on here: olljanat/docker-issue-tracking

olljanat avatar Apr 30 '18 07:04 olljanat

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 Jul 31 '18 03:07 docker-robott

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 21 '20 03:06 docker-robott