Multi-Host Docker Networking is now ready for production

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:

 

Single-Host

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.


 

Conclusion

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

 


Multi-Host Docker Networking is now ready for production


17 Responses to “Multi-Host Docker Networking is now ready for production”

  1. Docker 1.9: Virtual Network, Persistent Storage, Swarm

    […] Create virtual networks that span multiple hosts and backed by multiple plugins such as Calico, Weave, Cisco, and others (full details) […]

    Reply
  2. Docker 1.9 cures networking and storage ailments | POPALZ News – Latest news from Pakistan

    […] Docker 1.9 is out, and it fixes a longtime ailment for Docker users: networking. […]

    Reply
  3. Hitesh

    Great product! Would like to get regular updates.

    Reply
  4. Docker 1.9 cures networking and storage ailments - ARsoft Company

    […] Docker 1.9 is out, and it fixes a longtime ailment for Docker users: networking. […]

    Reply
  5. Le Docker nouveau est arrivé - SFEIR Mag

    […] Pour plus d’informations, je vous proposer d’aller voir ce lien ➜ Docker.com : Multi-Host Docker Networking is now ready for production […]

    Reply
  6. Docker 1.9 cures networking and storage ailments - SD Tech Today

    […] Docker 1.9 is out, and it fixes a longtime ailment for Docker users: networking. […]

    Reply
  7. Quan Nguyen

    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’.

    Reply
  8. 05-11-2015 - Links - Magnus Udbjørg

    […] Multi-Host Docker Networking is now ready for production – while we wait for our world to catch up… […]

    Reply
  9. Ressortez vos partitions pour Docker Compose 1.5 - SFEIR Mag

    […] allez faire un tour sur la release note. Une curiosité est l’accès en expérimental du Networking maintenant en version finale avec la dernière version de Docker Engine. Ce sujet sera traité […]

    Reply
  10. Docker Multi-Host Networking with Couchbase and WildFly

    […] Docker Multi-Host networking allows you to create virtual networks and attach containers to them so you can create the network topology that is right for your application. This blog will show how to use it with Docker Compose. […]

    Reply
  11. 터미널 도구 – figlet,lolcat – 실용주의 이야기

    […] 네트워킹 데모를 보던중 터미널에서도 몇가지 도구를 이용하면 멋진 데모를 할수 […]

    Reply
  12. Docker Multi-Host Networking with Couchbase and WildFly -

    […] Docker multi-host networking allows you to create virtual networks and attach containers to them so you can create the network topology that is right for your application. This blog will show how to use it with Docker Compose. […]

    Reply
  13. Docker Bridge and Overlay Network with Compose Variable Substitution

    […] Docker Multi-Host networking allows you to create virtual networks and attach containers to them so you can create the network topology that is right for your application. Bridge networks can be created for single host and overlay networks can be created for multiple hosts. Creating application-specific networks provides complete isolation for containers. […]

    Reply
  14. quenton

    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.)

    Reply
  15. Raj Durvasula

    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.

    Reply

Leave a Reply

Get the Latest Docker News by Email

Docker Weekly is a newsletter with the latest content on Docker and the agenda for the upcoming weeks.