Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

docker
docker swarm

What is Docker Swarm?

Educative Answers Team

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

widget

What is Docker Swarm?

Docker is a containerization system that enables developers and teams to handle containers that can be used in application deployment.

However, Docker is a single node that may only be able to support a certain number of containers. But what if the developer team requires the deployment of thousands of containers?

This where the concept of Docker Swarm comes in. A Docker Swarm is the virtualization of several Docker nodes (running Docker Engine) clustered together. Nodes in these clusters can communicate with each other and allow developers to manage numerous nodes in a single ecosystem.

Docker Swarm Architecture

svg viewer

In a Docker Swarm, there is a Docker Manager and several Docker Workers.

Docker Manager

A Docker Manager has complete control over what a Docker Worker does. Docker Manager assigns, controls, and manages the task appointed to each Docker Worker. Moreover, it keeps track of the status of all its workers. Docker Manager knows the task the worker is on, the task assigned to it, how the tasks are distributed among all the workers, and whether or not the worker is up/active.

The Docker Manager lets us create a new service and orchestrate it via its API. Then, it allocates workers to tasks using the IP addresses of different workers under its domain.

Note: There can be multiple Docker Managers. In such a scenario, there will be one primary manager and the rest will be secondary managers. All the manager nodes will elect this primary manager. While the secondary managers will be able to assign tasks and monitor workers, the primary manager reserves the power of control over all the worker nodes and secondary managers.

Docker Worker

A Docker Worker is entirely under the control of the Docker Manager. The Docker Worker accepts the tasks/instructions assigned to it by the Docker Manager and executes it. A Docker Worker consists of a client agent who communicates the status of the node to the manager. These communications are through REST API over HTTP.

Docker Daemon

The Docker Daemon listens for Docker API requests and manages Docker objects such as images, containers, networks, and volumes. It runs on your host operating system.

Fault Tolerance

svg viewer

In case a Docker Worker fails, the containers on that node are rescheduled to another node.

In case a Docker Worker fails, there is a Backup Folder that has all the data in it. This Backup Folder can be used to restore the swarm with a new Docker Manager.

Docker Swarm provides high availability of resources.

RELATED TAGS

docker
docker swarm
Copyright ©2022 Educative, Inc. All rights reserved

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring