✦ For everyone, free.

Practical knowledge for real and everyday life

Home

7.2.4 Overlay Driver

A focused guide to Overlay Driver, connecting core concepts with practical Docker and container operations.

The overlay network driver enables containers running on different physical or virtual hosts to communicate as though they were on the same local network, specifically designed for multi-host deployments such as a Docker Swarm cluster spanning several machines.

Why a Different Driver Is Needed for Multi-Host Networking

The bridge driver's virtual switch exists entirely within a single host's kernel — it has no mechanism for extending that same network across separate, physically distinct machines, which is precisely the gap the overlay driver fills.

docker network create --driver overlay --attachable myoverlay

This creates a network spanning multiple hosts in a Swarm cluster, something a bridge network simply cannot do.

Creating an Overlay Network in a Swarm

Overlay networks are typically created in the context of an initialized Docker Swarm, where multiple hosts have joined together as a single cluster.

docker swarm init
docker network create --driver overlay --attachable app-overlay
Attaching Standalone Containers to an Overlay Network

The --attachable flag allows individual containers (not just Swarm services) to join an overlay network directly, useful for mixing standalone containers with Swarm-managed services on the same network.

docker run -d --network app-overlay --name standalone-container alpine sleep 1000
Why Overlay Networks Matter for Distributed Applications

For an application whose components are deployed across multiple physical or virtual hosts — a common pattern in any cluster-based deployment — overlay networking provides the same convenient, name-resolvable connectivity a bridge network provides within a single host, extended transparently across the entire cluster.

docker service create --name web --network app-overlay --replicas 3 nginx:alpine
Why the Overlay Driver Matters

The overlay driver is what makes genuinely distributed, multi-host container networking practical, extending Docker's convenient container-to-container connectivity model beyond the boundaries of any single physical machine.

Content in this section