Docker Community Forums

Share and learn in the Docker community.

How to make docker(-compose) independent of the actual network interface?

Hi - I am pretty new to docker - so please bear with me. If that question has already been answered elsewhere (yes, I did search before posting here!) please provide me a pointer.

While developing and experimenting on my developer laptop (Windows 10 Pro) I am again and again banging into a very annoying detail:
Since this is on a Windows machine Docker makes use of the Hyper-V capabilities of Windows. During the installation of Docker I created a virtual switch as instructed creating an “External network” and assigning it to my actual network interface. Using that network my misc. containers can then talk to each other (and the host can connect to them as well).

HOWEVER, that works only as long as I am on that same network. In the office I am on a wired Ethernet. While commuting in the train or at home I am on a WLAN). The moment I disconnect from the cabled network, my containers can’t communicate any more with each other, since my laptop then disables its Ethernet network interface and instead enables the Wireless network controller.

I then need to go into Hyper-V’s Virtual Switch Manager and change the assignment of that network to the Wireless network adapter and then communication is restored, but as soon as I connect to our office network again there is the same issue in reverse: the Wifi-adapter gets disabled and the Ethernet adapter is re-enabled and communication between docker container is again dead until I change the adapter assignment back.

What is a good way or a preferred practice to create a virtual network that remains functional no matter whether my laptop is on the Ethernet or on Wifi and which still allows me (and docker) to connect to and manage those containers and experiment with them?