MENU
Docker Swarm
What is Docker Swarm? What does it do?
So far we have reployed our containers on one other single machine. What if we want to repeat the process for many different machines?
Docker Swarm performs container orchestration, allowing the redeployment and management of containers acorss a cluster of many different machines at the same time.

A possible configuration of Docker Swarm would look like this:

To use Docker Swarm:
- Install Docker engine on all the machines.
- Initialize Docker Swarm on the primary manager.
- Let other machines join as the secondary managers or workers.
- Create a service that creates replicas of containers across the cluster of nodes.
- Alternatively, use a stack on a 'docker compose file'.
- Manage the containers through a manager node.
- Leave or terminate a swarm.
Docker Swarm is a lightweight, easy-to-use orchestration tool with limited offerings compared to Kubernetes. In contrast, Kubernetes is complex but powerful and provides self-healing, auto-scaling capabilities out of the box.
NOTE: As of 16 Mar 2022, you cannot use Docker Swarm to manage multiple nodes on Windows and Mac. We will be using Google Compute Engine for our tutorial.
The Docker Swarm mode allows an easy and fast load balancing setup with minimal configuration. Nevertheless, having an external load balancer makes the setup simple to expand upon.
Even if a swarm loses the managers, swarm tasks on existing worker nodes continue to run. However, swarm nodes cannot be added, updated, or removed, and new or existing tasks cannot be started, stopped, moved, or updated.