Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker for Windows networking

Tags:

I'm having some trouble understanding Docker for Windows and how the networking works. In VirtualBox with a bridged adapter and an Ubuntu vm, things just worked - I could ping the vm from my host (and vice versa) fine.

  • How do I ping a container from any device on my network?
  • And how do ping other containers not running on the same host?

My plan...

was to have multiple windows machines (not vms) each running a single Docker container (to form a storage cluster), and these containers need to talk to each other (run using overlay network possibly, or does this require swarm?). I also need to talk to this externally, which is the only part I was able to get working, using the docker run -p option to expose the ports in the container I need.

To elaborate my though process a bit more, my goal is to build a Amazon S3 style key value store (specifically, using Riak KV) which runs on linux. Since this would require multiple computers running the software, it seemed to me that Docker could have benefits including, ease of setup and deployment, as well as a framework to run linux based softare on Windows, which is what I currently have easy access to.

Couple things I've tested...

If I run two Ubuntu containers on the same host using the default bridge network, they can ping each other. ifconfig lists a local and eth0 adapter with a 172.17... ip address. From this, it doesn't sound like bridge is what I'm looking for, since I want multiple hosts.

relatively small network on a single host

If I run an Ubuntu container using --network host I get a lot more output from ifconfig including "br-xxxxxxxx" and "vethxxxxxx" adapters. From the docs,

adds a container on the hosts network stack

This sounded useful, but perhaps I'm not understanding. I know Docker for windows runs a MobyLinuxVM, and uses a Hyper-V adapter and switch, what is host referring to? The windows pc or this VM? With --network host, I'm still unable to ping my container or ping my desktop from the container.

Other thoughts...

It seems the common use of Docker is NOT Windows based, so I've not been able to find as much to reference. Is my use case very different from the normal use of Docker? Can anyone point out things I am missing here?

Reading about Hyper-V adapters makes it look like I need to change my network adapter setup in addition to how I launch the containers? I guess, I'm having a hard time understanding where to look between windows, hyper-v adapter/switch, ubuntu, and docker.