How to properly setup docker networks on Windows 2016?
I have already setup docker engine modules and I got NAT switch automatically created. My question is: if there is any chance I could use existing Hyper-V virtual switch for connecting my containers to? Can I also make my network connection transparent? I would appreciate any guidelines on the matter. BONUS question: is there any realistic reason I should stay with Hyper-V containers rather than Window host kernel containers considering that I dont care much about security and my main purpose is just isolate some place for testing the applications and make the system as fast as possible? Thank you all.
Solution 1:
These materials should shed the light on the questions you've raised:
https://docs.microsoft.com/en-us/virtualization/windowscontainers/manage-containers/container-networking https://www.starwindsoftware.com/blog/get-started-with-windows-containers
A short excerpt: You can safely use pre-existing external hyper-v vSwitches for creating precisly transparent network connection. You will just need to define the container network as transparent using corresponding network driver.
Actually, the nat and transparent modes are not the only ones available. There are also overlay, l2bridge and l2tunnel networking drivers. Please refer to the articles I've provided above for more info.
As for your question whether to stay with Hyper-v or Windows containers, I would say it's completely up to you. From what I've seen, windows containers should boot quicker than Hyper-v ones, just because you don’t need to deploy an OS and you have not to waste additional RAM or storage resources for multiple operating systems.