Docker Swarm #
Allows running multiple Docker hosts as a single cluster.
Enables high availability and load balancing.
Requirements #
Multiple hosts with Docker installed, one host designated Swarm Manager
and others as Worker
(nodes).
Swarm Manager #
On the host to be the manager, run to start:
docker swarm init
This is immediately followed by a command output to be run on the worker
nodes to link them to the manager
. The command for the workers would be along the lines of:
docker swarm join --token <some token value>
Docker service #
To run multiple instances of containers efficiently across multiple nodes.
Run this on the manager node:
docker service create --replicas=<number of replicas across nodes> <application>