Difficulty: intermediate
Estimated Time: 10-15 minutes

In this scenario you'll learn how to use Overlay Networks as part of Swarm Mode. Overlay networks allow containers to communicate as if they're on the same host. Under the covers they use VxLan features of the Linux Kernel.


The environment has been configured with two Docker machines that can communicate with each over TCP.

In this scenario you learned how to create an Overlay Network and allow containers to communicate in a multi-host scenario.

Don’t stop now! The next scenario will only take about 10 minutes to complete.

Create Overlay Network

Step 1 of 4

Step 1 - Initialise Swarm Mode

By default, Docker works as an isolated single-node. All containers are only deployed onto the engine. Swarm Mode turns it into a multi-host cluster-aware engine.

Task: Initialise Swarm Mode

To use the secrets functionality, Docker has to be in "Swarm Mode". This is enabled via docker swarm init

Join Swarm Mode

Execute the command below on the second host to add it as a worker to the cluster.

token=$(docker -H [[HOST_IP]]:2345 swarm join-token -q worker) && docker swarm join [[HOST_IP]]:2377 --token $token

Terminal Host 2