What is Docker Swarm?
Answer
Docker Swarm is Docker's native clustering and orchestration solution, built into the Docker engine. It transforms a group of Docker hosts into a single virtual Docker host, enabling you to deploy and manage multi-container applications across multiple machines. Key concepts: (1) Swarm: the cluster of Docker hosts; (2) Node: a Docker host in the swarm — either a Manager (manages cluster state, schedules tasks) or Worker (executes containers); (3) Service: the definition of tasks to execute on Swarm — like a docker-compose.yml but for clusters. Includes the image, replicas count, update config, resource limits; (4) Task: a running container that is part of a service; (5) Stack: a group of services sharing a network, deployed with a Compose file (docker stack deploy -c compose.yml mystack). Features: load balancing (built-in mesh routing), service discovery, rolling updates with rollback, scaling (docker service scale web=5), secrets management, health checks, and self-healing (restarts failed containers). Initialize: docker swarm init. Add worker: docker swarm join --token TOKEN manager-ip:2377. Docker Swarm is simpler than Kubernetes but has less ecosystem support. Most new deployments use Kubernetes instead.
Previous
What are restart policies in Docker?
Next
What is the difference between EXPOSE and port publishing in Docker?