NetNat issues (failed to get IP; the parameter is incorrect)

Less a report of an issue, more a description of problem/solution. I was getting a failure of the VM to get an IP, and on resetting to factory was getting a “the parameter is incorrect” error in the logs:

[23:54:09.469][HyperV ][Info ] Creating Net NAT: DockerNAT…
[23:54:09.500][Notifications ][Error ] Error: Failed to create Switch “DockerNAT”: The parameter is incorrect.

This turned out to be because there was already a NetNat entry for ContainerNAT from previous plays with the MS Container stuff. The answer was to “Remove-NetNat -Name ContainerNAT”, then reset to factory in docker - once the other NetNat has been removed, the Docker one can be created.

I also resorted to cd’ing to C:\Program Files\Docker\Docker\Resources and running the MobyLinux.ps1 script direct for -stop, -start, -delete and -create - but only while trying to diagnose. Worth knowing about tho, as that script is pretty clear to read if you need to see what’s happening under the hood.

(Aside: Might be worth a Get-NetNat to check for existence of ContainerNat somewhere around the Create-Switch function, and warn/clean up/exit with descriptive error/use that instead of DockerNat if it’s there).

I had same issue and reported here as well + described the solution on http://docker-saigon.github.io/post/Docker-Beta/ (which was featured in this weekly newsletter) - there’s a bunch of other stuff in there that might interest you

Although I thought it was due to overlapping subnet on the NAT object and not necessarily if “ANY” NAT object already exists… it causes issues - I shld probably rule that out…

you do spell out the solution more clearly - I should add that as an addendum.