Docker 101 : An overview of the Swarm Overlay network

When we have multiple host running containers, each docker host has its private network in the "" range.
This network makes it possible for containers within a host to communicate with each other.

On the other hand, there is no way for container that live on different hosts to communicate with each other (as we can see in the above diagram), unless we set up a network than spans all the hosts.

Creating  an overlay network:

Before we can create an overlay swarm network, we need to either configure our machine as a swarm manager or join it to an existing swarm.
For that purpose we use an overlay network.

Overlay network creation:

Before creating an overlay network, we need to either set up our machine a swarm manager or join it as a worker machine to the swarm.

Then we can create the overlay network (overlay_1) with addresses in the range ( :

We can check the creation of the network using the below command:

In the example below we create three replicas of "debian" containers and attach them to the "overlay_1" overlay network, so they could communicate with each other across different nodes:

We get the below "debian" containers accross the swarm nodes:


Leave as a comment: