When Docker runs for the first time, it creates a network called “nat” and a Hyper-V switch called “nat”. I’d like to be able to attach my existing Hyper-V VMs to the “nat” switch and be able to share the network connection with any containers that get created.
The problem is that since the network addresses for the containers are essentially assigned at random, I’m worried that eventually there will be IP address conflict between a container and one of my VMs.
Is there any way to either 1) tell Docker to always assign IP addresses in a certain subnet or 2) to tell Docker to never assign an IP in the subnet of the VMs?
I’ve looked at that document before but didn’t find it very helpful since it’s targeted exclusively at Docker on Linux and the networking options that it uses on that operating system (which are quite different from what is used on Windows/Hyper-V). Was there a particular section that you thought might be helpful with regards to my issues with Docker for Windows? If you were going to try to control how Docker chooses subnets on Linux, where would you start?