SlideShare a Scribd company logo
1 of 14
Download to read offline
D CKER

SWARM MODE

ORCHESTRATION
ALİCAN AKKUŞ
software developer@iyzico @alican_akkus /aakkus alicanakkus.github.io - alicanakkus.com
DOCKER SWARM MODE
What will we be doing today?
‣ Clustering and container scheduling
‣ Understandable Distributed Consensus
‣ Build a swarm cluster
‣ One or more node will be manager
‣ Two or more node will be worker
‣ A sample app that uses a Java Spring Boot backend connected to a database to
display a fictitious art shop with a React front-end.
‣ Scale the number of containers in the swarm.
2
DOCKER SWARM MODE
Clustering and Container scheduling
‣ Orchestration is a broad term that refers to container scheduling, cluster management, and possibly the
provisioning of additional hosts.
‣ In this environment, "scheduling" refers to the ability for an administrator to load a service file onto a host system
that establishes how to run a specific container. 



While scheduling refers to the specific act of loading the service definition, in a more general sense, schedulers
are responsible for hooking into a host's init system to manage services in whatever capacity needed.
‣ Cluster management is the process of controlling a group of hosts. This can involve adding and removing hosts
from a cluster, getting information about the current state of hosts and containers, 

and starting and stopping processes. 



Cluster management is closely tied to scheduling because the scheduler must have access 

to each host in the cluster in order to schedule services. 

For this reason, the same tool is often used for both purposes.
3
DOCKER SWARM MODE
Swarm Mode Features
‣ The cluster management and orchestration features embedded in the Docker Engine.

‣ You enable swarm mode for an engine by either initializing a swarm or joining an existing
swarm.

‣ Docker provides isolation but Swarm mode provides scalability.

‣ With a single engine, applications can be scaled out faster and more effectively. 

‣ Swarm can scale up to 50,000 containers and 1,000 nodes with no effect on performance as
new containers are added to the cluster.
4
DOCKER SWARM MODE
Swarm Mode Features
‣ Declarative service model ; 

Docker Engine uses a declarative approach to let you define the desired state of the various services in
your application stack. For example, you might describe an application comprised of a web front end
service with message queueing services and a database backend.

‣ Scaling ; 

For each service, you can declare the number of tasks you want to run. When you scale up or down, the
swarm manager automatically adapts by adding or removing tasks to maintain the desired state.

‣ Desired state reconciliation ; 

The swarm manager node constantly monitors the cluster state and reconciles any differences between 

the actual state and your expressed desired state. 

For example, if you set up a service to run 10 replicas of a container, and a worker machine hosting 

two of those replicas crashes, the manager will create two new replicas to replace the replicas that
crashed. 

The swarm manager assigns the new replicas to workers that are running and available.
5
DOCKER SWARM MODE
Swarm Mode Features
‣ Multi-host networking ; 



You can specify an overlay network for your services. The swarm manager automatically assigns
addresses to the containers on the overlay network when it initializes or updates the application.

‣ 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 by default ; 



Each node in the swarm enforces TLS mutual authentication and encryption to secure 

communications between itself and all other nodes. 

You have the option to use self-signed root certificates or certificates from a custom root CA.
6
DOCKER SWARM MODE
Swarm Mode Features
‣ Rolling updates ; 



At rollout 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 a task to a previous version of the service.



‣ Service discovery ; 



 Swarm manager nodes assign each service in the swarm a unique DNS name and load
balances running containers. You can query every container running in the swarm through a
DNS server embedded in the swarm.

7
DOCKER SWARM MODE
Distributed Consensus - RAFT
‣ Consensus is a fundamental problem in fault-tolerant distributed systems. Consensus involves multiple servers agreeing on values.

‣ Raft is a consensus algorithm that is designed to be easy to understand. It's equivalent to Paxos in fault-tolerance and
performance. 

‣ A node can be in 1 of 3 states:
‣ the Follower state
‣ the Candidate state
‣ or the Leader state

‣ All our nodes start in the follower state. If followers don't hear from a leader then they can become a candidate.

‣ Once they reach a decision on a value, that decision is final.

‣ Raft tolerates up to (N-1)/2 failures and requires a majority or quorum of (N/2)+1 members to 

agree on values proposed to the cluster. 

‣ For example; a cluster of 5 servers can continue to operate even if 2 servers fail. 

If more servers fail, they stop making progress.
8
DOCKER SWARM MODE
Swarm Mode Features
9
DOCKER SWARM MODE
Swarm Mode Features
10
DOCKER SWARM MODE
Swarm Mode Features
11
DOCKER SWARM MODE
Docker Swarm Mode
‣ initalize swarm;
docker swarm init

‣ Once you’ve created a swarm with a manager node, you’re ready to add worker nodes.
docker swarm join --token SWTKN-1-231 192.168.99.100:2377

‣ you can join to swarm as manage or worker.

‣ run the docker node ls command to see the worker nodes;

* Swarm management commands like docker node ls only work on manager nodes.
id hostname status availability manager status
03g1y59jwfg7cf worker2 Ready Active -
a9j68exjopxe7w worker1 Ready Active -
dxn1zf6l61qsb * manager1 Ready Active Leader
12
DOCKER SWARM MODE
DEMO
‣ A sample app that uses a Java Spring Boot backend connected to a database to display a
fictitious art shop with a React front-end.

‣ We’ve 3 swarm nodes(one manager and two worker)

‣ https://github.com/AlicanAkkus/atsea-sample-shop-app
13
DOCKER SWARM MODE
THANKS :)

More Related Content

What's hot

What's hot (20)

Going Production with Docker and Swarm
Going Production with Docker and SwarmGoing Production with Docker and Swarm
Going Production with Docker and Swarm
 
The age of orchestration: from Docker basics to cluster management
The age of orchestration: from Docker basics to cluster managementThe age of orchestration: from Docker basics to cluster management
The age of orchestration: from Docker basics to cluster management
 
Using Docker Swarm Mode to Deploy Service Without Loss by Dongluo Chen & Nish...
Using Docker Swarm Mode to Deploy Service Without Loss by Dongluo Chen & Nish...Using Docker Swarm Mode to Deploy Service Without Loss by Dongluo Chen & Nish...
Using Docker Swarm Mode to Deploy Service Without Loss by Dongluo Chen & Nish...
 
Docker swarm reloaded
Docker swarm reloadedDocker swarm reloaded
Docker swarm reloaded
 
Docker swarm introduction
Docker swarm introductionDocker swarm introduction
Docker swarm introduction
 
Docker Swarm Introduction
Docker Swarm IntroductionDocker Swarm Introduction
Docker Swarm Introduction
 
Containers orchestrators: Docker vs. Kubernetes
Containers orchestrators: Docker vs. KubernetesContainers orchestrators: Docker vs. Kubernetes
Containers orchestrators: Docker vs. Kubernetes
 
Docker Swarm 45-min Workshop (Mountain View Docker Meetup 2/24/2016)
Docker Swarm 45-min Workshop (Mountain View Docker Meetup 2/24/2016)Docker Swarm 45-min Workshop (Mountain View Docker Meetup 2/24/2016)
Docker Swarm 45-min Workshop (Mountain View Docker Meetup 2/24/2016)
 
Docker Swarm Is Dead: Long Live Docker Swarm
Docker Swarm Is Dead: Long Live Docker SwarmDocker Swarm Is Dead: Long Live Docker Swarm
Docker Swarm Is Dead: Long Live Docker Swarm
 
Swarm - A Docker Clustering System
Swarm - A Docker Clustering SystemSwarm - A Docker Clustering System
Swarm - A Docker Clustering System
 
What's New in Docker 1.12?
What's New in Docker 1.12?What's New in Docker 1.12?
What's New in Docker 1.12?
 
Chef cookbooks for OpenStack HA
Chef cookbooks for OpenStack HAChef cookbooks for OpenStack HA
Chef cookbooks for OpenStack HA
 
Docker Online Meetup #28: Production-Ready Docker Swarm
Docker Online Meetup #28: Production-Ready Docker SwarmDocker Online Meetup #28: Production-Ready Docker Swarm
Docker Online Meetup #28: Production-Ready Docker Swarm
 
Docker swarm workshop
Docker swarm workshopDocker swarm workshop
Docker swarm workshop
 
Docker Swarm & Machine
Docker Swarm & MachineDocker Swarm & Machine
Docker Swarm & Machine
 
Docker swarm
Docker swarmDocker swarm
Docker swarm
 
Clustering with Docker Swarm - Dockerops 2016 @ Cento (FE) Italy
Clustering with Docker Swarm - Dockerops 2016 @ Cento (FE) ItalyClustering with Docker Swarm - Dockerops 2016 @ Cento (FE) Italy
Clustering with Docker Swarm - Dockerops 2016 @ Cento (FE) Italy
 
What's New in Docker 1.12 (June 20, 2016) by Mike Goelzer & Andrea Luzzardi
What's New in Docker 1.12 (June 20, 2016) by Mike Goelzer & Andrea LuzzardiWhat's New in Docker 1.12 (June 20, 2016) by Mike Goelzer & Andrea Luzzardi
What's New in Docker 1.12 (June 20, 2016) by Mike Goelzer & Andrea Luzzardi
 
Docker Up and Running for Web Developers
Docker Up and Running for Web DevelopersDocker Up and Running for Web Developers
Docker Up and Running for Web Developers
 
Nebulaworks Docker Overview 09-22-2015
Nebulaworks Docker Overview 09-22-2015Nebulaworks Docker Overview 09-22-2015
Nebulaworks Docker Overview 09-22-2015
 

Similar to Docker Swarm Mode Orchestration

Similar to Docker Swarm Mode Orchestration (20)

FIWARE Tech Summit - Docker Swarm Secrets for Creating Great FIWARE Platforms
FIWARE Tech Summit - Docker Swarm Secrets for Creating Great FIWARE PlatformsFIWARE Tech Summit - Docker Swarm Secrets for Creating Great FIWARE Platforms
FIWARE Tech Summit - Docker Swarm Secrets for Creating Great FIWARE Platforms
 
Docker Swarm secrets for creating great FIWARE platforms
Docker Swarm secrets for creating great FIWARE platformsDocker Swarm secrets for creating great FIWARE platforms
Docker Swarm secrets for creating great FIWARE platforms
 
Characterizing and Contrasting Kuhn-tey-ner Awr-kuh-streyt-ors
Characterizing and Contrasting Kuhn-tey-ner Awr-kuh-streyt-orsCharacterizing and Contrasting Kuhn-tey-ner Awr-kuh-streyt-ors
Characterizing and Contrasting Kuhn-tey-ner Awr-kuh-streyt-ors
 
Docker Swarm and Traefik 2.0
Docker Swarm and Traefik 2.0Docker Swarm and Traefik 2.0
Docker Swarm and Traefik 2.0
 
JDO 2019: Container orchestration with Docker Swarm - Jakub Hajek
JDO 2019: Container orchestration with Docker Swarm - Jakub HajekJDO 2019: Container orchestration with Docker Swarm - Jakub Hajek
JDO 2019: Container orchestration with Docker Swarm - Jakub Hajek
 
Container orchestration from theory to practice
Container orchestration from theory to practiceContainer orchestration from theory to practice
Container orchestration from theory to practice
 
Orchestrating Linux Containers while tolerating failures
Orchestrating Linux Containers while tolerating failuresOrchestrating Linux Containers while tolerating failures
Orchestrating Linux Containers while tolerating failures
 
Docker Swarm vs. Kubernetes Which is the best
Docker Swarm vs. Kubernetes Which is the bestDocker Swarm vs. Kubernetes Which is the best
Docker Swarm vs. Kubernetes Which is the best
 
Container World 2017 - Characterizing and Contrasting Container Orchestrators
Container World 2017 - Characterizing and Contrasting Container OrchestratorsContainer World 2017 - Characterizing and Contrasting Container Orchestrators
Container World 2017 - Characterizing and Contrasting Container Orchestrators
 
Putting Kafka In Jail – Best Practices To Run Kafka On Kubernetes & DC/OS
Putting Kafka In Jail – Best Practices To Run Kafka On Kubernetes & DC/OSPutting Kafka In Jail – Best Practices To Run Kafka On Kubernetes & DC/OS
Putting Kafka In Jail – Best Practices To Run Kafka On Kubernetes & DC/OS
 
Docker Networking - Common Issues and Troubleshooting Techniques
Docker Networking - Common Issues and Troubleshooting TechniquesDocker Networking - Common Issues and Troubleshooting Techniques
Docker Networking - Common Issues and Troubleshooting Techniques
 
Higher order infrastructure: from Docker basics to cluster management - Nicol...
Higher order infrastructure: from Docker basics to cluster management - Nicol...Higher order infrastructure: from Docker basics to cluster management - Nicol...
Higher order infrastructure: from Docker basics to cluster management - Nicol...
 
Digital Forensics and Incident Response in The Cloud Part 3
Digital Forensics and Incident Response in The Cloud Part 3Digital Forensics and Incident Response in The Cloud Part 3
Digital Forensics and Incident Response in The Cloud Part 3
 
Container Orchestration from Theory to Practice
Container Orchestration from Theory to PracticeContainer Orchestration from Theory to Practice
Container Orchestration from Theory to Practice
 
What is the Difference Between Kubernetes and Docker?
What is the Difference Between Kubernetes and Docker?What is the Difference Between Kubernetes and Docker?
What is the Difference Between Kubernetes and Docker?
 
9th docker meetup 2016.07.13
9th docker meetup 2016.07.139th docker meetup 2016.07.13
9th docker meetup 2016.07.13
 
Container Orchestration with Docker Swarm and Kubernetes
Container Orchestration with Docker Swarm and KubernetesContainer Orchestration with Docker Swarm and Kubernetes
Container Orchestration with Docker Swarm and Kubernetes
 
Stop Worrying and Keep Querying, Using Automated Multi-Region Disaster Recovery
Stop Worrying and Keep Querying, Using Automated Multi-Region Disaster RecoveryStop Worrying and Keep Querying, Using Automated Multi-Region Disaster Recovery
Stop Worrying and Keep Querying, Using Automated Multi-Region Disaster Recovery
 
AstriCon 2017 - Docker Swarm & Asterisk
AstriCon 2017  - Docker Swarm & AsteriskAstriCon 2017  - Docker Swarm & Asterisk
AstriCon 2017 - Docker Swarm & Asterisk
 
Docker swarm - An introduction to Docker native clustering
Docker swarm - An introduction to Docker native clusteringDocker swarm - An introduction to Docker native clustering
Docker swarm - An introduction to Docker native clustering
 

Recently uploaded

Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
chiefasafspells
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
masabamasaba
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 

Recently uploaded (20)

Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 

Docker Swarm Mode Orchestration

  • 1. D CKER
 SWARM MODE
 ORCHESTRATION ALİCAN AKKUŞ software developer@iyzico @alican_akkus /aakkus alicanakkus.github.io - alicanakkus.com
  • 2. DOCKER SWARM MODE What will we be doing today? ‣ Clustering and container scheduling ‣ Understandable Distributed Consensus ‣ Build a swarm cluster ‣ One or more node will be manager ‣ Two or more node will be worker ‣ A sample app that uses a Java Spring Boot backend connected to a database to display a fictitious art shop with a React front-end. ‣ Scale the number of containers in the swarm. 2
  • 3. DOCKER SWARM MODE Clustering and Container scheduling ‣ Orchestration is a broad term that refers to container scheduling, cluster management, and possibly the provisioning of additional hosts. ‣ In this environment, "scheduling" refers to the ability for an administrator to load a service file onto a host system that establishes how to run a specific container. 
 
 While scheduling refers to the specific act of loading the service definition, in a more general sense, schedulers are responsible for hooking into a host's init system to manage services in whatever capacity needed. ‣ Cluster management is the process of controlling a group of hosts. This can involve adding and removing hosts from a cluster, getting information about the current state of hosts and containers, 
 and starting and stopping processes. 
 
 Cluster management is closely tied to scheduling because the scheduler must have access 
 to each host in the cluster in order to schedule services. 
 For this reason, the same tool is often used for both purposes. 3
  • 4. DOCKER SWARM MODE Swarm Mode Features ‣ The cluster management and orchestration features embedded in the Docker Engine.
 ‣ You enable swarm mode for an engine by either initializing a swarm or joining an existing swarm.
 ‣ Docker provides isolation but Swarm mode provides scalability.
 ‣ With a single engine, applications can be scaled out faster and more effectively. 
 ‣ Swarm can scale up to 50,000 containers and 1,000 nodes with no effect on performance as new containers are added to the cluster. 4
  • 5. DOCKER SWARM MODE Swarm Mode Features ‣ Declarative service model ; 
 Docker Engine uses a declarative approach to let you define the desired state of the various services in your application stack. For example, you might describe an application comprised of a web front end service with message queueing services and a database backend.
 ‣ Scaling ; 
 For each service, you can declare the number of tasks you want to run. When you scale up or down, the swarm manager automatically adapts by adding or removing tasks to maintain the desired state.
 ‣ Desired state reconciliation ; 
 The swarm manager node constantly monitors the cluster state and reconciles any differences between 
 the actual state and your expressed desired state. 
 For example, if you set up a service to run 10 replicas of a container, and a worker machine hosting 
 two of those replicas crashes, the manager will create two new replicas to replace the replicas that crashed. 
 The swarm manager assigns the new replicas to workers that are running and available. 5
  • 6. DOCKER SWARM MODE Swarm Mode Features ‣ Multi-host networking ; 
 
 You can specify an overlay network for your services. The swarm manager automatically assigns addresses to the containers on the overlay network when it initializes or updates the application.
 ‣ 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 by default ; 
 
 Each node in the swarm enforces TLS mutual authentication and encryption to secure 
 communications between itself and all other nodes. 
 You have the option to use self-signed root certificates or certificates from a custom root CA. 6
  • 7. DOCKER SWARM MODE Swarm Mode Features ‣ Rolling updates ; 
 
 At rollout 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 a task to a previous version of the service.
 
 ‣ Service discovery ; 
 
  Swarm manager nodes assign each service in the swarm a unique DNS name and load balances running containers. You can query every container running in the swarm through a DNS server embedded in the swarm.
 7
  • 8. DOCKER SWARM MODE Distributed Consensus - RAFT ‣ Consensus is a fundamental problem in fault-tolerant distributed systems. Consensus involves multiple servers agreeing on values.
 ‣ Raft is a consensus algorithm that is designed to be easy to understand. It's equivalent to Paxos in fault-tolerance and performance. 
 ‣ A node can be in 1 of 3 states: ‣ the Follower state ‣ the Candidate state ‣ or the Leader state
 ‣ All our nodes start in the follower state. If followers don't hear from a leader then they can become a candidate.
 ‣ Once they reach a decision on a value, that decision is final.
 ‣ Raft tolerates up to (N-1)/2 failures and requires a majority or quorum of (N/2)+1 members to 
 agree on values proposed to the cluster. 
 ‣ For example; a cluster of 5 servers can continue to operate even if 2 servers fail. 
 If more servers fail, they stop making progress. 8
  • 9. DOCKER SWARM MODE Swarm Mode Features 9
  • 10. DOCKER SWARM MODE Swarm Mode Features 10
  • 11. DOCKER SWARM MODE Swarm Mode Features 11
  • 12. DOCKER SWARM MODE Docker Swarm Mode ‣ initalize swarm; docker swarm init
 ‣ Once you’ve created a swarm with a manager node, you’re ready to add worker nodes. docker swarm join --token SWTKN-1-231 192.168.99.100:2377
 ‣ you can join to swarm as manage or worker.
 ‣ run the docker node ls command to see the worker nodes;
 * Swarm management commands like docker node ls only work on manager nodes. id hostname status availability manager status 03g1y59jwfg7cf worker2 Ready Active - a9j68exjopxe7w worker1 Ready Active - dxn1zf6l61qsb * manager1 Ready Active Leader 12
  • 13. DOCKER SWARM MODE DEMO ‣ A sample app that uses a Java Spring Boot backend connected to a database to display a fictitious art shop with a React front-end.
 ‣ We’ve 3 swarm nodes(one manager and two worker)
 ‣ https://github.com/AlicanAkkus/atsea-sample-shop-app 13