Docker for Windows Networks

I'm having trouble understanding Docker for Windows and how the network works. In VirtualBox with the bridge adapter and Ubuntu vm, everything just worked - I could ping vm from my host (and vice versa) in order.

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

My plan...

had to have several window machines (not vms), each of which started one Docker container (to form a storage cluster), and these containers should talk to each other (perhaps using the overlay network or does this require swarm ?). I also need to talk to this from the outside, which is the only part I was able to work with, using the docker run -p option to display the ports in the container I need.

To develop my process at least a little, my goal is to create an Amazon S3 style key value store (in particular, using Riak KV) that runs on Linux. Since this would require several computers running the software, it seemed to me that Docker could have advantages, including ease of setup and deployment, as well as a platform for running linux based on Windows software, which I currently have Time has easy access.

A couple of things I tested ...

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

relatively small network on one host

If I start the Ubuntu container using --network host , I get a lot more results from ifconfig , including the adapters "br-xxxxxxxx" and "thank youxxxxx". From the documents

adds a container to the network stack of hosts

It sounded useful, but maybe I don't get it. I know that Docker for Windows launches MobyLinuxVM and uses a Hyper-V adapter and switch, what does the host refer to? Windows pc or this virtual machine? With --network host I still cannot ping my container or ping my desktop from the container.

Other thoughts ...

It seems that the normal use of Docker is not based on Windows OS, so I could not find so many links. Is my use case different from normal use of Docker? Can anyone point out what I'm missing here?

Reading about Hyper-V adapters makes me wonder how I need to change my network adapter settings in addition to how I start containers? I guess it's hard for me to figure out where to look for windows, hyper-v adapter / switch, ubuntu and docker.

+6
source share
1 answer

Great question. I supported him to counter the downward line you received. The question is well written and I don't see any problems with it. Perhaps they thought this was not the case with StackOverflow and was better suited to ServerFault.

Here are some useful bullets:

  • Docker for Windows creates a Hyper-V virtual machine called MobyLinuxVM .
  • Hyper-V virtual virtual machines must be connected to the virtual switch in order to access the network.
  • Docker for Windows creates a Hyper-V Internal virtual switch named DockerNAT
  • Check out What is explained by the Hyper-V virtual switch for more information about the type of Internal Virtual Switch (you have already contacted this)

Docker swarm

  • Using overlay network does require Docker Swarm mode (see SwarmKit )

Bottom line:

The script you are trying to solve is not suitable for Docker for Windows. Docker for Windows is designed so that software developers can write, debug and test their applications against a local Linux VM with the Docker Engine installed. This is about it. Docker for Windows automates the process of setting up a Hyper-V virtual machine, installing Linux, installing the Docker Engine, and making it accessible from the command line.

Your proposed scenario in the My Plan section will not be suitable for Docker for Windows. Instead, I would suggest setting up Docker Swarm Mode cluster mode. However, storing dockers is much more complicated. You will also want to explore the use of the Docker storage driver, which provides shared storage in your Swarm cluster from Docker Hosts. There is a very popular Flocker developed by ClusterHQ . I would recommend exploring this as a possible solution.

However, I also suggest reevaluating your goals and how you will achieve them. Docker might not even be the best solution for shared storage.

Hope this helps you.

+7
source

All Articles