Hi all, this document deals with the introduction to docker swarm.
Docker is one of the hot topics in microservice based application deployment. Using docker containers made deployment easy for a complex application which has many modules. One of the best of example for microservice is the current application architecture of UBER application.
Previously Uber application architecture was not microservices, where all the modules are combined together as a single application. Due to this traditional architecture, they faced many difficulties while scaling the application when the number of users increased. Where they have the modules like payment, pick up, drop etc.
By approaching the microservice architecture they are able to scale up their modules as per the user loads rather than scaling the whole application. This helps them to achieve many users and cost reduction. All these micro-services are deployed in Docker containers.
Now, let’s look into the deployment of Docker container. Deployment of Docker containers is very easy using docker run command.
The above command is okay if an application to be deployed one or two servers. So think about of application to be deployed in n number of servers to hold n number of users. This becomes a headache for deployment engineer to manage, same happens if there change in build, the engineer has to go to each and every server deploys the containers. This is a tough job.
In order to overcome this type of situation docker itself comes with an orchestration tool called DOCKER SWARM. There are many other orchestration tools available such as DOCKER SWARM, KUBERNATES, MESOS etc.
These types of the tool provide clustering for all the docker containers and work as together as per requirement. This made deployment, scaling easier.
As I said before Docker swarm is a docker orchestration tool developed by docker inc, where services and tasks are deployed.
The later versions of Docker 1.2 have inbuilt docker swarm installed.
There are two components available in docker swarm, one is manager node and other is worker node. Manager nodes are the leader who defines tasks for all the worker node attached to the manager node.
* Initialise a cluster of docker engines in swarm mode
* Add all the nodes to docker swarm
* Deploy services to docker swarm
* Manage docker swarm from manager node while services are running
Docker swarm helps to scale up/Down your services as per your needs without disturbing the running services. Using docker swarm you can mention how many docker containers required for your service. The manager takes part the decision making and allocates the containers in the worker nodes. The manager keeps monitor the worker nodes, if it detects any of the worker nodes are unresponsive then it manager do move the containers to healthy worker node in order to maintain the number of containers.
Here is the basic architecture of docker swarm
Benefits of docker swarm
* Centralized management for all the docker containers/services
* Load balancing (internal / External LB)
* Rolling updates ( Build Updates)
* relocating containers from host to another, if the host becomes unresponsive
Subscribe for more tutorials on Docker swarm, We will update SOON…..
Happy Learning 🙂
© 2019, Techrunnr. All rights reserved.