Create a custom network in a Swarm cluster

Multi-host networks require a key-value store. The key-value store holds
information about the network state which includes discovery, networks,
endpoints, IP addresses, and more. Through the Docker’s libkv project, Docker
supports Consul, Etcd, and ZooKeeper key-value store backends. For details about
the supported backends, refer to the libkv
project.

To create a custom network, you must choose a key-value store backend and
implement it on your network. Then, you configure the Docker Engine daemon to
use this store. Two required parameters, --cluster-store and
--cluster-advertise, refer to your key-value store server.

Once you’ve configured and restarted the daemon on each Swarm node, you are
ready to create a network.

List networks

This example assumes there are two nodes node-0 and node-1 in the cluster.
From a Swarm node, list the networks:

Create a network

By default, Swarm is using the overlay network driver, a global-scope network
driver. A global-scope network driver creates a network across an entire Swarm cluster.
When you create an overlay network under Swarm, you can omit the -d option: