SlideShare ist ein Scribd-Unternehmen logo
1 von 20
Docker Swarm
Author : Rajdeep Dua, VMware
Twitter : @rajdeepdua
Last Updated : March 25 2015
Overview
• Allows to manage Docker Cluster Remotely
• Key Components
– Swarm Manager
– Swarm Node
– Scheduler
– Discovery
Architecture Diagram
Swarm Manager
• Manages the Nodes in the Cluster
• Uses Docker APIs to access the Docker Daemon
running on each node
• Nodes are added to the Swarm manager by
callback from Discovery Service’s fetch() function
• Elements of a Swarm Cluster Manager
– Event Handler
– Map of Nodes
– Store
– Options
Swarm Node
• Runtime Instance representing a node in the Cluster.
• Talks to the actual Host using Docker Go Client
• Created from a DiscoveryEntry fetched from a Discovery Service
• Elements of Swarm Node
– Id
– IP Address (of remote host)
– Map of Containers
– Map of Images
– Health state of the node
– Total CPUs
– Used CPUs
– Total Memory
– Used Memory
Scheduler
• Responsible for scheduling a container on a
Node
• Pluggable architecture – Bring your own
scheduler
• Elements of a Scheduler
– Placement Strategy Instance
– Array of Filters
Scheduler .. contd
• The `Docker Swarm` scheduler comes with multiple strategies.
• These strategies are used to rank nodes using a scores
computed by the strategy. `Docker Swarm` currently supports
2 strategies:
– BinPacking Strategy
– Random Strategy
Usage : You can choose the strategy you want to use with the `--
strategy` flag of `swarm manage`
Scheduler .. contd
BinPacking strategy
• The BinPacking strategy will rank the nodes using their CPU and RAM
available and will return the node the most packed already.
• This avoid fragmentation, it will leave room for bigger containers on
unused machines.
Random strategy
• The Random strategy, as it's name says, chooses a random node, it's used
mainly for debug
Scheduler Filters
• Scheduler uses the following filters for container
placement on a node
– Affinity Filter
– Constraint Filter : When creating a container, the user
can select a subset of nodes that should be
considered for scheduling by specifying one or more
sets of matching key/value pairs.
– Port Filter : Select node where public port required by
the container is not already used
– Health Filter : Select only healthy nodes from the
cluster
Swarm Store
• Stores the state of the Cluster.
• Currently implemented as a JSON file
• State is loaded in memory when the cluster starts
• Lifecycle events of the store
– Get state for a key
– Store the state of a container
– Load all the data stored
– Replace the state of the key with a new state
– Delete the state
Discovery Service
• Helps Swarm Manager discover nodes
• Three main functions
– Register : Registers a new node
– Watch : Callback method for Swarm Manager
when a new Node is added to the Discovery
Service
– Fetch : Fetch the List of Entries
Discovery Services
• Token Based
• etcd based
• Zookeeper based
• File Based
• Consul Based
• Bring your own?
Docker Swarm Architecture - Exploded
Token Based Discovery Service
• Based on REST End Point hosted on Docker-
hub
• URL Queried for entries is
DISCOVERY_URL = "https://discovery-stage.hub.docker.com/v1"
HTTP GET https://discovery-stage.hub.docker.com/v1/clusters/<token-id>
Discovery Fetch Entries
Swarm CLI
• Allows Setting up and Managing the Cluster
create a cluster
$ docker run --rm swarm create
6856663cdefdec325839a4b7e1de38e8
On each nodes, start the swarm agent
$ docker run -d swarm join --addr=<node_ip:2375> token://<cluster_id>
Swarm CLI
Start the manager on any machine / Laptop to manage the
cluster
$ docker run -d -p <swarm_port>:2375 swarm manage token://<cluster_id>
Use the regular docker cli
$ docker -H tcp://<swarm_ip:swarm_port> info
$ docker -H tcp://<swarm_ip:swarm_port> run ...
$ docker -H tcp://<swarm_ip:swarm_port> ps
$ docker -H tcp://<swarm_ip:swarm_port> logs ...
…
List nodes in your cluster
$ docker run --rm swarm list token://<cluster_id>
<node_ip:2375>
Swarm APIs
• Compatible with Docker Remote API with
some differences
• Containers
GET /containers/(id)
POST /containers/create
DELETE /containers/(id)
POST /container/(id)/start
additional parameters passed in the POST body
Swarm APIs…
Images
GET /images/json
POST /images/create
DELETE /images/(id)
GET /images/search
Summary
• Docker Swarm allows you to use native Docker
CLI commands and APIs to manage containers
across a cluster of nodes
• It has a basic scheduler which can be
enhanced
• Pluggable Discovery mechanism

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Kubernetes Basics
Kubernetes BasicsKubernetes Basics
Kubernetes Basics
 
Kubernetes - A Comprehensive Overview
Kubernetes - A Comprehensive OverviewKubernetes - A Comprehensive Overview
Kubernetes - A Comprehensive Overview
 
Présentation docker et kubernetes
Présentation docker et kubernetesPrésentation docker et kubernetes
Présentation docker et kubernetes
 
Introduction to helm
Introduction to helmIntroduction to helm
Introduction to helm
 
DevOps with Kubernetes
DevOps with KubernetesDevOps with Kubernetes
DevOps with Kubernetes
 
Docker 101 : Introduction to Docker and Containers
Docker 101 : Introduction to Docker and ContainersDocker 101 : Introduction to Docker and Containers
Docker 101 : Introduction to Docker and Containers
 
Docker introduction
Docker introductionDocker introduction
Docker introduction
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 
Kubernetes Monitoring & Best Practices
Kubernetes Monitoring & Best PracticesKubernetes Monitoring & Best Practices
Kubernetes Monitoring & Best Practices
 
Kubernetes Architecture and Introduction
Kubernetes Architecture and IntroductionKubernetes Architecture and Introduction
Kubernetes Architecture and Introduction
 
Multi Stage Docker Build
Multi Stage Docker Build Multi Stage Docker Build
Multi Stage Docker Build
 
Hands-On Introduction to Kubernetes at LISA17
Hands-On Introduction to Kubernetes at LISA17Hands-On Introduction to Kubernetes at LISA17
Hands-On Introduction to Kubernetes at LISA17
 
Introduction to Docker Containers - Docker Captain
Introduction to Docker Containers - Docker CaptainIntroduction to Docker Containers - Docker Captain
Introduction to Docker Containers - Docker Captain
 
Kubernetes Architecture
 Kubernetes Architecture Kubernetes Architecture
Kubernetes Architecture
 
Docker Swarm for Beginner
Docker Swarm for BeginnerDocker Swarm for Beginner
Docker Swarm for Beginner
 
Kubernetes Introduction
Kubernetes IntroductionKubernetes Introduction
Kubernetes Introduction
 
Kubernetes 101
Kubernetes 101Kubernetes 101
Kubernetes 101
 
Docker
DockerDocker
Docker
 
Kubernetes and service mesh application
Kubernetes  and service mesh applicationKubernetes  and service mesh application
Kubernetes and service mesh application
 
Midi technique - présentation docker
Midi technique - présentation dockerMidi technique - présentation docker
Midi technique - présentation docker
 

Andere mochten auch

Load Balancing Apps in Docker Swarm with NGINX
Load Balancing Apps in Docker Swarm with NGINXLoad Balancing Apps in Docker Swarm with NGINX
Load Balancing Apps in Docker Swarm with NGINX
NGINX, Inc.
 

Andere mochten auch (20)

Docker Swarm: Docker Native Clustering
Docker Swarm: Docker Native ClusteringDocker Swarm: Docker Native Clustering
Docker Swarm: Docker Native Clustering
 
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
 
Introction to docker swarm
Introction to docker swarmIntroction to docker swarm
Introction to docker swarm
 
Docker swarm introduction
Docker swarm introductionDocker swarm introduction
Docker swarm introduction
 
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
 
Load Balancing Apps in Docker Swarm with NGINX
Load Balancing Apps in Docker Swarm with NGINXLoad Balancing Apps in Docker Swarm with NGINX
Load Balancing Apps in Docker Swarm with NGINX
 
Docker swarm
Docker swarmDocker swarm
Docker swarm
 
Docker, Docker Swarm mangement tool - Gorae
Docker, Docker Swarm mangement tool - GoraeDocker, Docker Swarm mangement tool - Gorae
Docker, Docker Swarm mangement tool - Gorae
 
Introduction to docker swarm
Introduction to docker swarmIntroduction to docker swarm
Introduction to docker swarm
 
Docker Networking & Swarm Mode Introduction
Docker Networking & Swarm Mode IntroductionDocker Networking & Swarm Mode Introduction
Docker Networking & Swarm Mode Introduction
 
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
 
Docker Architecture (v1.3)
Docker Architecture (v1.3)Docker Architecture (v1.3)
Docker Architecture (v1.3)
 
Introduction to Kubernetes
Introduction to KubernetesIntroduction to Kubernetes
Introduction to Kubernetes
 
Docker Networking Deep Dive
Docker Networking Deep DiveDocker Networking Deep Dive
Docker Networking Deep Dive
 
Docker Networking: Control plane and Data plane
Docker Networking: Control plane and Data planeDocker Networking: Control plane and Data plane
Docker Networking: Control plane and Data plane
 
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
 
Docker Machine & Docker Swarm
Docker Machine & Docker SwarmDocker Machine & Docker Swarm
Docker Machine & Docker Swarm
 
Kubernetes Mesos Architecture
Kubernetes Mesos ArchitectureKubernetes Mesos Architecture
Kubernetes Mesos Architecture
 
docker-machine, docker-compose, docker-swarm 覚書
docker-machine, docker-compose, docker-swarm 覚書docker-machine, docker-compose, docker-swarm 覚書
docker-machine, docker-compose, docker-swarm 覚書
 
Docker 1.5
Docker 1.5Docker 1.5
Docker 1.5
 

Ähnlich wie Docker Swarm Introduction

Ähnlich wie Docker Swarm Introduction (20)

Introducing Docker Swarm - the orchestration tool by Docker
Introducing Docker Swarm - the orchestration tool by DockerIntroducing Docker Swarm - the orchestration tool by Docker
Introducing Docker Swarm - the orchestration tool by Docker
 
DockerCon SF 2015: Orchestration for Sysadmins
DockerCon SF 2015: Orchestration for SysadminsDockerCon SF 2015: Orchestration for Sysadmins
DockerCon SF 2015: Orchestration for Sysadmins
 
Orchestrating Linux Containers while tolerating failures
Orchestrating Linux Containers while tolerating failuresOrchestrating Linux Containers while tolerating failures
Orchestrating Linux Containers while tolerating failures
 
Dockertaipei 20150528-dockerswarm
Dockertaipei 20150528-dockerswarmDockertaipei 20150528-dockerswarm
Dockertaipei 20150528-dockerswarm
 
Containers orchestrators: Docker vs. Kubernetes
Containers orchestrators: Docker vs. KubernetesContainers orchestrators: Docker vs. Kubernetes
Containers orchestrators: Docker vs. Kubernetes
 
Alex Dias: how to build a docker monitoring solution
Alex Dias: how to build a docker monitoring solution Alex Dias: how to build a docker monitoring solution
Alex Dias: how to build a docker monitoring solution
 
Benchmarking Solr Performance at Scale
Benchmarking Solr Performance at ScaleBenchmarking Solr Performance at Scale
Benchmarking Solr Performance at Scale
 
What’s new in Swarm 1.1
What’s new in Swarm 1.1What’s new in Swarm 1.1
What’s new in Swarm 1.1
 
PostgreSQL and Linux Containers
PostgreSQL and Linux ContainersPostgreSQL and Linux Containers
PostgreSQL and Linux Containers
 
Docker 1.11 Presentation
Docker 1.11 PresentationDocker 1.11 Presentation
Docker 1.11 Presentation
 
DOD 2016 - Stefan Thies - Monitoring and Log Management for Docker Swarm and...
 DOD 2016 - Stefan Thies - Monitoring and Log Management for Docker Swarm and... DOD 2016 - Stefan Thies - Monitoring and Log Management for Docker Swarm and...
DOD 2016 - Stefan Thies - Monitoring and Log Management for Docker Swarm and...
 
Postgre sql linuxcontainers by Jignesh Shah
Postgre sql linuxcontainers by Jignesh ShahPostgre sql linuxcontainers by Jignesh Shah
Postgre sql linuxcontainers by Jignesh Shah
 
AstriCon 2017 - Docker Swarm & Asterisk
AstriCon 2017  - Docker Swarm & AsteriskAstriCon 2017  - Docker Swarm & Asterisk
AstriCon 2017 - Docker Swarm & Asterisk
 
Monitoring and Log Management for
Monitoring and Log Management forMonitoring and Log Management for
Monitoring and Log Management for
 
Continuous Deployment with Akka.Cluster and Kubernetes (Akka.NET)
Continuous Deployment with Akka.Cluster and Kubernetes (Akka.NET)Continuous Deployment with Akka.Cluster and Kubernetes (Akka.NET)
Continuous Deployment with Akka.Cluster and Kubernetes (Akka.NET)
 
[Devconf.cz][2017] Understanding OpenShift Security Context Constraints
[Devconf.cz][2017] Understanding OpenShift Security Context Constraints[Devconf.cz][2017] Understanding OpenShift Security Context Constraints
[Devconf.cz][2017] Understanding OpenShift Security Context Constraints
 
Kubernetes Walk Through from Technical View
Kubernetes Walk Through from Technical ViewKubernetes Walk Through from Technical View
Kubernetes Walk Through from Technical View
 
SFBay Area Solr Meetup - June 18th: Benchmarking Solr Performance
SFBay Area Solr Meetup - June 18th: Benchmarking Solr PerformanceSFBay Area Solr Meetup - June 18th: Benchmarking Solr Performance
SFBay Area Solr Meetup - June 18th: Benchmarking Solr Performance
 
stackconf 2020 | Replace your Docker based Containers with Cri-o Kata Contain...
stackconf 2020 | Replace your Docker based Containers with Cri-o Kata Contain...stackconf 2020 | Replace your Docker based Containers with Cri-o Kata Contain...
stackconf 2020 | Replace your Docker based Containers with Cri-o Kata Contain...
 
Demystfying container-networking
Demystfying container-networkingDemystfying container-networking
Demystfying container-networking
 

Mehr von rajdeep

Openstack meetup-pune-aug22-overview
Openstack meetup-pune-aug22-overviewOpenstack meetup-pune-aug22-overview
Openstack meetup-pune-aug22-overview
rajdeep
 
Cloud Foundry Architecture and Overview
Cloud Foundry Architecture and OverviewCloud Foundry Architecture and Overview
Cloud Foundry Architecture and Overview
rajdeep
 
Google cloud platform
Google cloud platformGoogle cloud platform
Google cloud platform
rajdeep
 

Mehr von rajdeep (14)

Aura Framework Overview
Aura Framework OverviewAura Framework Overview
Aura Framework Overview
 
Openstack Overview
Openstack OverviewOpenstack Overview
Openstack Overview
 
virtualization-vs-containerization-paas
virtualization-vs-containerization-paasvirtualization-vs-containerization-paas
virtualization-vs-containerization-paas
 
VMware Hybrid Cloud Service - Overview
VMware Hybrid Cloud Service - OverviewVMware Hybrid Cloud Service - Overview
VMware Hybrid Cloud Service - Overview
 
Cloudfoundry Overview
Cloudfoundry OverviewCloudfoundry Overview
Cloudfoundry Overview
 
OpenvSwitch Deep Dive
OpenvSwitch Deep DiveOpenvSwitch Deep Dive
OpenvSwitch Deep Dive
 
Openstack meetup-pune-aug22-overview
Openstack meetup-pune-aug22-overviewOpenstack meetup-pune-aug22-overview
Openstack meetup-pune-aug22-overview
 
Deploy Cloud Foundry using bosh_bootstrap
Deploy Cloud Foundry using bosh_bootstrapDeploy Cloud Foundry using bosh_bootstrap
Deploy Cloud Foundry using bosh_bootstrap
 
Managing Activity Backstack
Managing Activity BackstackManaging Activity Backstack
Managing Activity Backstack
 
Cloud Foundry Architecture and Overview
Cloud Foundry Architecture and OverviewCloud Foundry Architecture and Overview
Cloud Foundry Architecture and Overview
 
Cloud Foundry Open Tour India 2012 , Keynote
Cloud Foundry Open Tour India 2012 , KeynoteCloud Foundry Open Tour India 2012 , Keynote
Cloud Foundry Open Tour India 2012 , Keynote
 
Play Support in Cloud Foundry
Play Support in Cloud FoundryPlay Support in Cloud Foundry
Play Support in Cloud Foundry
 
Google cloud platform
Google cloud platformGoogle cloud platform
Google cloud platform
 
Introduction to Google App Engine
Introduction to Google App EngineIntroduction to Google App Engine
Introduction to Google App Engine
 

Kürzlich hochgeladen

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Kürzlich hochgeladen (20)

What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 

Docker Swarm Introduction

  • 1. Docker Swarm Author : Rajdeep Dua, VMware Twitter : @rajdeepdua Last Updated : March 25 2015
  • 2. Overview • Allows to manage Docker Cluster Remotely • Key Components – Swarm Manager – Swarm Node – Scheduler – Discovery
  • 4. Swarm Manager • Manages the Nodes in the Cluster • Uses Docker APIs to access the Docker Daemon running on each node • Nodes are added to the Swarm manager by callback from Discovery Service’s fetch() function • Elements of a Swarm Cluster Manager – Event Handler – Map of Nodes – Store – Options
  • 5. Swarm Node • Runtime Instance representing a node in the Cluster. • Talks to the actual Host using Docker Go Client • Created from a DiscoveryEntry fetched from a Discovery Service • Elements of Swarm Node – Id – IP Address (of remote host) – Map of Containers – Map of Images – Health state of the node – Total CPUs – Used CPUs – Total Memory – Used Memory
  • 6. Scheduler • Responsible for scheduling a container on a Node • Pluggable architecture – Bring your own scheduler • Elements of a Scheduler – Placement Strategy Instance – Array of Filters
  • 7. Scheduler .. contd • The `Docker Swarm` scheduler comes with multiple strategies. • These strategies are used to rank nodes using a scores computed by the strategy. `Docker Swarm` currently supports 2 strategies: – BinPacking Strategy – Random Strategy Usage : You can choose the strategy you want to use with the `-- strategy` flag of `swarm manage`
  • 8. Scheduler .. contd BinPacking strategy • The BinPacking strategy will rank the nodes using their CPU and RAM available and will return the node the most packed already. • This avoid fragmentation, it will leave room for bigger containers on unused machines. Random strategy • The Random strategy, as it's name says, chooses a random node, it's used mainly for debug
  • 9. Scheduler Filters • Scheduler uses the following filters for container placement on a node – Affinity Filter – Constraint Filter : When creating a container, the user can select a subset of nodes that should be considered for scheduling by specifying one or more sets of matching key/value pairs. – Port Filter : Select node where public port required by the container is not already used – Health Filter : Select only healthy nodes from the cluster
  • 10. Swarm Store • Stores the state of the Cluster. • Currently implemented as a JSON file • State is loaded in memory when the cluster starts • Lifecycle events of the store – Get state for a key – Store the state of a container – Load all the data stored – Replace the state of the key with a new state – Delete the state
  • 11. Discovery Service • Helps Swarm Manager discover nodes • Three main functions – Register : Registers a new node – Watch : Callback method for Swarm Manager when a new Node is added to the Discovery Service – Fetch : Fetch the List of Entries
  • 12. Discovery Services • Token Based • etcd based • Zookeeper based • File Based • Consul Based • Bring your own?
  • 14. Token Based Discovery Service • Based on REST End Point hosted on Docker- hub • URL Queried for entries is DISCOVERY_URL = "https://discovery-stage.hub.docker.com/v1" HTTP GET https://discovery-stage.hub.docker.com/v1/clusters/<token-id>
  • 16. Swarm CLI • Allows Setting up and Managing the Cluster create a cluster $ docker run --rm swarm create 6856663cdefdec325839a4b7e1de38e8 On each nodes, start the swarm agent $ docker run -d swarm join --addr=<node_ip:2375> token://<cluster_id>
  • 17. Swarm CLI Start the manager on any machine / Laptop to manage the cluster $ docker run -d -p <swarm_port>:2375 swarm manage token://<cluster_id> Use the regular docker cli $ docker -H tcp://<swarm_ip:swarm_port> info $ docker -H tcp://<swarm_ip:swarm_port> run ... $ docker -H tcp://<swarm_ip:swarm_port> ps $ docker -H tcp://<swarm_ip:swarm_port> logs ... … List nodes in your cluster $ docker run --rm swarm list token://<cluster_id> <node_ip:2375>
  • 18. Swarm APIs • Compatible with Docker Remote API with some differences • Containers GET /containers/(id) POST /containers/create DELETE /containers/(id) POST /container/(id)/start additional parameters passed in the POST body
  • 19. Swarm APIs… Images GET /images/json POST /images/create DELETE /images/(id) GET /images/search
  • 20. Summary • Docker Swarm allows you to use native Docker CLI commands and APIs to manage containers across a cluster of nodes • It has a basic scheduler which can be enhanced • Pluggable Discovery mechanism