What is Docker Swarm?
Why Interviewers Ask This
This question tests conceptual clarity. Interviewers want to hear a precise, confident definition before moving to more complex Docker topics. It also reveals how well you can explain technical ideas to non-experts.
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.
Pro Tip
This topic has Docker-specific nuances that differ from general programming. Highlighting those nuances in your answer shows expertise rather than generic knowledge.
Previous
What are restart policies in Docker?
Next
What is the difference between EXPOSE and port publishing in Docker?