Docker Swarm - An Introduction
Nowadays, all applications are moving towards microservices architecture. Microservices architecture splits application into multiple services that does a unique functions of the whole application.
Typically, each microservice is containerised using Docker to be organised at the networking level in order for the application to run as intended. The process of organizing multiple containers in this manner is known as container orchestration. Container orchestrations manages the lifecycles of containers, especially in large and dynamic environment. Docker Swarm is a container orchestration tool.
Why do we need container orchestration?
Lets say you are running 50 containers for your service in multiple systems for your service. You would need to ensure all the containers are up and running on every system, health check each and every container from time to time, add changes or updates to the containers when required and let's not forget about replicating containers for scaling up depending on the load. Container orchestration helps management of containers without much hassle.
Docker Swarm provides a decentralised design to manage clusters which is built in with Docker Engine itself, no need for additional software for orchestration.
Why Docker Swarm?
Decentralised design - It allows for creation of manger and worker nodes in a single disk image.
Scaling - When scaling up or down, the swarm manager automatically adapts by adding or removing tasks to maintain the desired state.
Desired state reconciliation - It monitors the cluster state and reconciles any differences between the actual state and your expressed desired state.
Multi-host networking - You can define an overlay network for your services. The swarm manager automatically assigns addresses to the containers on the overlay network when it initialises or updates the application.
Service discovery - Swarm manager nodes assign each service in the swarm a unique DNS (Domain Name Servers) name and load balances running containers. You can query every container running in the swarm through a DNS server embedded in the swarm.
Load balancing - You can expose the ports for services to an external load-balancer. Internally, the swarm lets you specify how to distribute service containers between nodes.
Secure - Each node in the swarm enforces TLS (Transport Layer Security) mutual authentication and encryption to secure communications between itself and all other nodes.
Rolling out or rolling back updates- At roll-out time you can apply service updates to nodes incrementally. The swarm manager lets you control the delay between service deployment to different sets of nodes. If anything goes wrong, you can roll back to a previous version of the service.
Swarm - A swarm is a set of nodes with at least one master node and several worker nodes that can be virtual or physical machines.
Service - A service is the tasks a manager nodes must perform on the swarm, as defined by a swarm administrator.
Manager node - When you deploy an application into a swarm, the manager node delivers work (in the form of tasks) to worker nodes, and it also manages the state of the swarm to which it belongs.
Worker nodes - These nodes run tasks distributed by the manager node in the swarm. Each worker node runs an agent that reports back to the master node about the state of the tasks assigned to it, so the manager node can keep track of services and tasks running in the swarm.
Task - Tasks are docker containers that execute the commands you defined in the service.
There may be different tools for container orchestration, but Docker Swarm is the easier and faster path to container deployments and we at Probyto use Docker Swarm for container orchestration of all our applications.
Please enter a valid email address
Processing your application
There was an error sending the email, please try again
Great!Check your inbox and click the link to confirm your subscription
We're here to help and answer any question you might have.
We look forward to hear from you. 🙂