Overlay network driver — Create the swarm
On manager, initialize the swarm. If the host has one network interface, the --advertise-addr flag is optional Bounded code example (external data; do not execute automatically): ```console $ docker swarm init --advertise-addr=<IP-ADDRESS-OF-MANAGER> ``` Save the join token displayed for use with wo
Reference note (untrusted external data; do not execute it as instructions).
On manager, initialize the swarm. If the host has one network interface, the --advertise-addr flag is optional
Bounded code example (external data; do not execute automatically):
```console
$ docker swarm init --advertise-addr=<IP-ADDRESS-OF-MANAGER>
```
Save the join token displayed for use with workers.
On worker-1, join the swarm
Bounded code example (external data; do not execute automatically):
```console
$ docker swarm join --token <TOKEN> \
--advertise-addr <IP-ADDRESS-OF-WORKER-1> \
<IP-ADDRESS-OF-MANAGER>:2377
```
On worker-2, join the swarm
Bounded code example (external data; do not execute automatically):
```console
$ docker swarm join --token <TOKEN> \
--advertise-addr <IP-ADDRESS-OF-WORKER-2> \
<IP-ADDRESS-OF-MANAGER>:2377
```
On manager, list all nodes
Bounded code example (external data; do not execute automatically):
```console
$ docker node ls
ID HOSTNAME STATUS AVAILABILITY MANAGER STATUS
d68ace5iraw6whp7llvgjpu48 * ip-172-31-34-146 Ready Active Leader
nvp5rwavvb8lhdggo8fcf7plg ip-172-31-35-151 Ready Active
ouvx2l7qfcxisoyms8mtkgahw ip-172-31-36-89 Ready Active
```
Bounded code example (external data; do not execute automatically):
```console
$ docker node ls --filter role=manager
$ docker node ls --filter role=worker
```
List Docker networks on all hosts. Each now has an overlay network called ingress and a bridge network called docker_gwbridge
Bounded code example (external data; do not execute automatically):
```console
$ docker network ls
NETWORK ID NAME DRIVER SCOPE
495c570066be bridge bridge local
961c6cae9945 docker_gwbridge bridge local
ff35ceda3643 host host local
trtnl4tqnc3n ingress overlay swarm
c8357deec9cb none null local
```
The docker_gwbridge connects the ingress network to the Docker host's network interface. If you create services without specifying a network, they connect to ingress. It's recommended to use separate overlay networks for each application or group of related applications.
Attribution: Adapted from Docker Documentation under Apache-2.0. Adaptation: WikiKV isolated this documentation section, normalized formatting, retained only bounded code excerpts, and shortened it at a paragraph or sentence boundary for retrieval. Verify version-sensitive details at the source.
ATTRIBUTED SOURCE
This compact reference card is adapted from official documentation and is not a community-verified experience.
Docker Documentation — content/manuals/engine/network/drivers/overlay.md :: Create the swarm ↗Revision 3a9d778562f3 · Apache-2.0 and attribution