Dave Tucker

Multi-Host Docker Networking is now ready for production

Dave Tucker

At DockerCon in June, we first introduced experimental support for Docker Networking. In Docker 1.9, we are excited to announce that Networking is ready to use in production and works with Swarm and Compose.

Networking is a feature of Docker Engine that allows you to create virtual networks and attach containers to them so you can create the network topology that is right for your application. The networked containers can even span multiple hosts, so you don’t have to worry about what host your container lands on. They seamlessly communicate with each other wherever they are – thus enabling true distributed applications.

Networking is also pluggable, so you can use any third-party networking driver to power your networks without having to make changes to your application. You can find an up-to-date list of available plugins here and check out these plugins that are already available from our partners Weave, Project Calico, VMware, Cisco, Midokura and Microsoft.


Networking vs. Links

We know that some users love the simplicity of links and you can still use links in the docker0 network. But we’d recommend that you try out our new networking because unlike links, it allows you to:

  1. Connect containers to each other across different physical or virtual hosts
  2. Containers using Networking can be easily stopped, started and restarted without disrupting the connections to other containers
  3. You don’t need to create a container before you can link to it. With Networking containers be created in any order and discover each other using their container names


Using Networking

You can use Networking on its own or combined with Swarm and Compose. Here’s a brief walkthrough to get you started:



You can get started with Networking straight away by using the new docker network command.

You can create a new network with docker network create. In this example, we’ll create a network called “frontend” and run an nginx container inside it:

$ docker network create frontend
$ docker run -itd --net=frontend --name web nginx

You can use networks to separate your applications, or even separate individual components of your application. For example, we could run a web application in a network called “app” and then use the docker network connect command so our Nginx container can forward connections to it.

$ docker network create app
$ docker run -itd --name myapp --net=app <my application container>
$ docker network connect app web


Now Nginx should be able to connect to your application using the hostname “myapp.app”


Multi-Host Networking

You can use Machine to set up an environment to experiment with multi-host Networking using this script. This will create one machine, running Consul in a container. This is needed to allow network state to be shared across the Engines. It then creates two further machines for running our containers. Watch this video to see how it works:

While this is useful, you’ll notice that you have to use docker-machine config to point your Docker client at each machine.

Using Swarm makes this a little more exciting. You can create Swarms with Machine using this script. The setup is much the same as described in the Multi-Host example but this time we have clustered our Engines using Swarm.

Check it out in this video:


Adding Compose to the mix

Compose is a fantastic way to define distributed applications. In this example, we’ll use a simple Python web application that increments a counter in MongoDB every time somebody visits the page. This is deployed on the same environment as the Swarm example. Since our containers are now using Networking instead of links, Swarm is able to schedule the containers on any host in the Swarm! Let’s try it out.



Docker’s new networking is Software Defined Networking (SDN) for containers. With SDN we give developers the flexibility to network their apps as you want without having to wait on the network operations team.

However, we do this in a way that is friendly to the network operations team – VXLAN, the technology that underpins our multi-host driver has been in use for the last 4 years and it was standardized in August 2014. We also provide the ability to swap out our own driver for one that fits the network operations team’s needs without changing the application.

We hope that you find the new networking features useful. As always, we’re continuing to improve them so if you have suggestions then we’d love to hear from you on GitHub. Also – thank you to everyone who tried it out while it was in the experimental release. Your feedback was invaluable.

To get started with Docker Networking, download Docker Toolbox and check out our documentation. And join us for our online meetup on Networking with Docker engineers. If you have any questions, join our IRC channel #docker-network on Freenode, post in our forums, or post on StackOverflow.


 Learn More about Docker

• New to Docker? Try our 10 min online tutorial
• Sign up for a free 30 day trial of Docker
• Share images, automate builds, and more with a free Docker Hub account
• Read the Docker 1.9 Release Notes
• Subscribe to Docker Weekly
• Register for upcoming Docker Online Meetups
• Attend upcoming Docker Meetups
• Register for DockerCon Europe 2015
• Start contributing to Docker



17 thoughts on “Multi-Host Docker Networking is now ready for production

  1. Great product! Would like to get regular updates.

  2. I have problems to run the multihost swarm script tutorial.

    Here is the output:

    $ ./multihost-local-sh
    Running pre-create checks…
    Creating machine…
    Waiting for machine to be running, this may take a few minutes…
    Machine is running, waiting for SSH to be available…
    Detecting operating system of created instance…
    Provisioning created instance…
    Copying certs to the local machine directory…
    Copying certs to the remote machine…
    Setting Docker configuration on the remote daemon…
    To see how to connect Docker to this machine, run: C:\Program Files\Docker Toolbox\docker-machine.exe env mhl-consul
    docker: ‘Nguyen\\.docker\\machine\\certs\\ca.pem”‘ is not a docker command.
    See ‘docker –help’.

  3. All of the examples of multi-host networking I have found use a single physical machine with multiple VM’s. Is multi-host networking supported for hosts on different physical machines running OSx? (I’ve successfully set up multi-host networking using NUCs running Coreos but have been unable to successfully set up multi-host networking on machines running OSx.)

  4. My question is exactly the same as @quenton ..

    A true Multi-host networking sample should showcase containers and network configuration across 2 or physical machines.

    For simplicity, the hosts could be 2 VMs too.

    In real world overlay network across physical / virtual Hosts are expected for Production-grade deployments.

    What I found so far on Docker documentation and blogs is 2 virtualbox VMs as hosts with few containers running with overlay network.

Leave a Reply