Docs / Containers & Docker / How to Set Up Docker Overlay Networks for Multi-Host

How to Set Up Docker Overlay Networks for Multi-Host

By Admin · Mar 1, 2026 · Updated Apr 25, 2026 · 24 views · 1 min read

Setting Up Docker Overlay Networks for Multi-Host Communication

Docker overlay networks enable containers running on different Breeze instances to communicate securely as if they were on the same local network. This is essential for distributed applications and Docker Swarm clusters.

Initialize Docker Swarm

On the manager node:

docker swarm init --advertise-addr 10.0.1.10

This outputs a join token. On each worker Breeze:

docker swarm join --token SWMTKN-1-xxxx 10.0.1.10:2377

Create an Overlay Network

docker network create \
  --driver overlay \
  --subnet 10.10.0.0/16 \
  --attachable \
  my-overlay

The --attachable flag allows standalone containers (not just services) to join the network.

Deploy Services on the Overlay

docker service create \
  --name web \
  --network my-overlay \
  --replicas 3 \
  -p 80:80 \
  nginx:alpine

docker service create \
  --name api \
  --network my-overlay \
  --replicas 2 \
  my-api:latest

Service Discovery

Containers on the same overlay network resolve each other by service name:

# From inside the web container
curl http://api:3000/health

Encryption

Enable IPsec encryption for data in transit between hosts:

docker network create \
  --driver overlay \
  --opt encrypted \
  secure-overlay

Troubleshooting

  • Ensure ports 2377/tcp, 7946/tcp+udp, and 4789/udp are open between nodes
  • Use docker network inspect my-overlay to verify peer connectivity
  • Check docker node ls to confirm all nodes are in Ready state

Was this article helpful?