# Docker Swarm

> The tool in Docker that runs containers on many machines. It joins them into one group.

**Field:** Infrastructure  
**Category:** Container Orchestration  
**Also known as:** Swarm Mode, Docker Swarm Mode, docker swarm init

## Think of it like

It is like a team captain. The players are there, and the captain tells each one where to stand.

## Definition

Docker Swarm is the orchestrator built into Docker. Its proper name is swarm mode. It joins several machines that run Docker into one group, called a swarm. Some machines are managers that make the plans. The rest are workers that run the containers. It uses the same docker commands and compose files people already know.

## Example

A team of three already runs its app with Docker Compose. They turn on swarm mode on two servers and run three copies of the app with one command.

## Example code

```bash
docker swarm init
docker service create --name web --replicas 3 -p 8080:80 nginx
```

The first line turns this machine into a manager. The second asks the swarm for three copies of a web server.

## Why it matters

It is far smaller than Kubernetes to learn. For a few servers, it can be all a team needs.

## Common mistake

Mixing it up with the old Classic Swarm. That was a separate tool, and it is no longer worked on.

## Three principles

- **Built in.** Nothing extra to install beyond Docker.
- **Managers and workers.** Managers plan, workers run the containers.
- **Familiar files.** It reads the same compose files.

## Related terms

- [Container Orchestration](https://learn.benibix.com/term/infrastructure/container-orchestration)
- [Kubernetes (K8s)](https://learn.benibix.com/term/infrastructure/kubernetes)
- [Docker](https://learn.benibix.com/term/infrastructure/docker)
- [Docker Compose](https://learn.benibix.com/term/infrastructure/docker-compose)

![A large box marked cluster. At the top sits the control plane. Below it are three nodes in a row. Each node holds pods, and each pod holds one or two containers. On the left, outside the cluster, a person types kubectl commands, and an arrow runs from them to the control plane.](https://learn.benibix.com/diagrams/inf-k8s-cluster.svg)

---

Source: https://learn.benibix.com/term/infrastructure/docker-swarm
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-17
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
