Docker and Docker Swarm (Part 5 – Docker Swarm Features)

Tram Ho

I. Features of Docker Swarm

Cluster management integrated with Docker Engine: Use Docker CLI to generate swarm to deploy services. No additional software is required to create and manage swarm

Distributed Deployment: Instead of handling the differences between nodes’ roles at deployment time, Docker Engine handles whatever tasks are running. We can deploy both types of nodes as managers and workers using Docker Engine. This means we can create a complete Docker Swarm from just a single image.

Scaling:  For each service deployed in Docker Swarm, you can declare the number of tasks you want to run. As you scale or vice versa, Docker Swarm automatically adjusts by adding or removing tasks to maintain the desired state – the state of the system we need to achieve. Ensure stability: Docker Swarm will continuously monitor the state of the cluster and resolve any variation between the actual state and the desired state based on your decisions. Example: We set up a service with 5 copies of containers and a worker node that hosts 2 copies of containers. Manager node will automatically create 2 more copies of containers if 2 copies of containers in worker node fail, … Manager Node will always ensure new copies of containers for workers are running or provisioned. Multi-host networking: It is possible to declare an overlay network for services in Swarm. Docker Swarm will automatically manage and assign IP addresses to each container on the overlay network when it initializes or updates the application. Service discovery: Swarm manager node will assign each service in Docker Swarm to a unique DNS name and load balance running containers. You can query all containers running in Swarm through a DNS Server embedded in Swarm. Load balancing:  You can expose ports for services to an external load balancer. In Swarm, allows you to specify how to distribute services between nodes. Swarm manager uses network ingress load balancing to expose services outside of swarm. Swarm manager can automatically put services on unused ports in the range 30000-32767. Or the user can also automatically specify the port to which the service will be assigned. – External applications can access the service through the Published Ports at any node in the cluster, whether or not that node has this service. All nodes in Swarm will connect to the ingress router to connect to active tasks. – Inside Swarm mode, each service will be assigned an internal DNS to access. The Swarm manager will use internal load balancing to send requests to services in the cluster based on that service’s DNS.

Rolling Update: You can apply an application update (mostly version images) at a time. If an error occurs, we can rollback to the previous version of services. High Availability, Enables State Replication:  Docker Swarm allows replication of the Docker node’s state in Swarm. Follow the order of the following images to better understand this feature of Docker.

With Docker Swarm, instead of having one manager, and the manager node can fail to provision Swarm, you can deploy multiple manager nodes at the same time.

When an active manager node crashes

Manager node will be automatically transferred to another node (backup node):

Compare Docker Swarm vs Kubernetes, Apache Mesos

1. Docker Swarm

2. Kubernetes

3. Apache Mesos

Tài liệu tham khảo

[1]. How node works

[2]. Docker docs

[3]. Docker là gì?

Share the news now