SlideShare ist ein Scribd-Unternehmen logo
1 von 18
Downloaden Sie, um offline zu lesen
Docker Swarm Mode
Dharmit Shah
@dharm1t
Who am I?
● Software Engineer @ Red Hat; developing developer tools
● Co-organizer of Docker and Ansible meetups
● Work on CentOS, Docker, Ansible, Vagrant, etc.
● Love vim, zsh, i3wm, and all things CLI
● dharmit on GitHub
dharm1t on Twitter
What is Swarm Mode?
● A mode built into Docker Engine
● Available with Docker 1.12 or later
● Lets you manage a cluster of Docker Engines
● Cluster of Docker Engines is called a swarm
● Use the familiar Docker CLI to create a swarm, deploy
application services to a swarm, and manage swarm
behavior.
● Swarm Mode != Swarm Kit
Features
● Cluster management integrated with Docker Engine
● Can deploy Manager/Worker node using Docker Engine
● Declarative model to describe entire application stack
● Scale up or down based on requirements
● Constantly monitors and reconciles the cluster state
● Built in service discovery
● TLS auth and encryption for secure communication
Hands-on
My Setup
● 2 VMs running on DigitalOcean
● 1 will run as manager
● 1 will run as worker
● Add 1 VM to work as manager
Initialize a Swarm
$ docker swarm init
● This command will initialize a swarm
● Docker Engine targeted by this command becomes a manager
in the newly created single-node swarm
● Generates two random tokens - manager and worker tokens
● Use proper token to make a node join as worker or manager
Add a node to Swarm
$ docker swarm join 
--token <random-token-generated-by-previous-command> 
<ip-port-of-manager>
This command will add a node to a Swarm as worker node
$ docker swarm join-token manager
This command will add a manager node to Swarm
Create services
$ docker service create --name redis redis:3.0.6
Creates a service named redis
$ docker service create --name redis --replicas=5
redis:3.0.6
Creates a service redis with 5 replicas across the swarm
$ docker service ls
Lists the services in the cluster
Replicated mode & Global mode
$ docker service create --name redis --replicas=5 redis:3.0.6
Creates a service redis with 5 replicas across the swarm
$ docker service create --name redis --mode global redis:3.0.6
Creates a global service with 1 container on each node
Attach service to network
$ docker network create --driver overlay my-network
$ docker service create 
--replicas 3 --network my-network --name my-web 
nginx
$ docker service ls
Containers on the same network can access each other using
service discovery
Publish Service Ports
$ docker service create --name my_web --replicas 3 --publish
8080:80 nginx
Makes service accessible on port 8080 of every node
regardless if there is a container running for that service
on the node!
Swarm Inspect
$ docker service inspect nginx
● Provides JSON output
● Same as docker inspect for containers
● Should be run only on manager nodes
Swarm Update
● Update an existing service
$ docker service update --publish-add 6379:6379 redis
Publishes redis service to port 6379 on all nodes in Swarm
$ docker service update --image redis:latest redis
Let’s watch the output of “$ docker service ps redis”
Has many, many more options! Refer the docs.
Scale a service
$ docker service create --name redis redis:3.0.6
Creates a single container on a random node in the Swarm
$ docker service scale redis=2
Starts another container on a random node
ps, ls, rm,
● ps
○ List the tasks of a service
● ls
○ Lists the services in the swarm
● rm
○ Removes a service from the swarm
References
● https://docs.docker.com
● Slideshare by Mike Goelzer and Andrea Luzzardi
● Docker Community Repo
● And some tinkering with containers…
Thank you!

Weitere ähnliche Inhalte

Was ist angesagt?

Docker Swarm Introduction
Docker Swarm IntroductionDocker Swarm Introduction
Docker Swarm Introductionrajdeep
 
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, Inc.
 
Swarm - A Docker Clustering System
Swarm - A Docker Clustering SystemSwarm - A Docker Clustering System
Swarm - A Docker Clustering Systemsnrism
 
Introduction to docker swarm
Introduction to docker swarmIntroduction to docker swarm
Introduction to docker swarmWalid Ashraf
 
Going Production with Docker and Swarm
Going Production with Docker and SwarmGoing Production with Docker and Swarm
Going Production with Docker and SwarmC4Media
 
Docker Swarm 0.2.0
Docker Swarm 0.2.0Docker Swarm 0.2.0
Docker Swarm 0.2.0Docker, Inc.
 
Consul and docker swarm cluster
Consul and docker swarm clusterConsul and docker swarm cluster
Consul and docker swarm clusterEueung Mulyana
 
Docker Swarm & Machine
Docker Swarm & MachineDocker Swarm & Machine
Docker Swarm & MachineEueung Mulyana
 
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 NGINXNGINX, Inc.
 
Container Orchestration with Docker Swarm
Container Orchestration with Docker SwarmContainer Orchestration with Docker Swarm
Container Orchestration with Docker SwarmFrederik Mogensen
 
Docker Machine & Docker Swarm
Docker Machine & Docker SwarmDocker Machine & Docker Swarm
Docker Machine & Docker SwarmGuillermo Lucero
 
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)Mike Goelzer
 
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 SwarmDocker, Inc.
 
Dockercon Swarm Updated
Dockercon Swarm UpdatedDockercon Swarm Updated
Dockercon Swarm UpdatedDocker, Inc.
 
Docker cluster with swarm, consul, registrator and consul-template
Docker cluster with swarm, consul, registrator and consul-templateDocker cluster with swarm, consul, registrator and consul-template
Docker cluster with swarm, consul, registrator and consul-templateJulien Maitrehenry
 
Docker 1.12 & Swarm Mode [Montreal Docker Meetup Sept. 2016]
Docker 1.12 & Swarm Mode [Montreal Docker Meetup Sept. 2016]Docker 1.12 & Swarm Mode [Montreal Docker Meetup Sept. 2016]
Docker 1.12 & Swarm Mode [Montreal Docker Meetup Sept. 2016]Brice Argenson
 
Service Discovery & Load-Balancing under Docker 1.12.0 @ Docker Meetup #22
Service Discovery & Load-Balancing under Docker 1.12.0 @ Docker Meetup #22Service Discovery & Load-Balancing under Docker 1.12.0 @ Docker Meetup #22
Service Discovery & Load-Balancing under Docker 1.12.0 @ Docker Meetup #22Ajeet Singh Raina
 

Was ist angesagt? (20)

Docker Swarm Introduction
Docker Swarm IntroductionDocker Swarm Introduction
Docker Swarm Introduction
 
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...
 
Swarm - A Docker Clustering System
Swarm - A Docker Clustering SystemSwarm - A Docker Clustering System
Swarm - A Docker Clustering System
 
Introduction to docker swarm
Introduction to docker swarmIntroduction to docker swarm
Introduction to docker swarm
 
Going Production with Docker and Swarm
Going Production with Docker and SwarmGoing Production with Docker and Swarm
Going Production with Docker and Swarm
 
Docker swarm
Docker swarmDocker swarm
Docker swarm
 
Docker Swarm 0.2.0
Docker Swarm 0.2.0Docker Swarm 0.2.0
Docker Swarm 0.2.0
 
Consul and docker swarm cluster
Consul and docker swarm clusterConsul and docker swarm cluster
Consul and docker swarm cluster
 
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?
 
Docker Swarm & Machine
Docker Swarm & MachineDocker Swarm & Machine
Docker Swarm & Machine
 
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
 
Container Orchestration with Docker Swarm
Container Orchestration with Docker SwarmContainer Orchestration with Docker Swarm
Container Orchestration with Docker Swarm
 
Docker Machine & Docker Swarm
Docker Machine & Docker SwarmDocker Machine & Docker Swarm
Docker Machine & Docker Swarm
 
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 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
 
Dockercon Swarm Updated
Dockercon Swarm UpdatedDockercon Swarm Updated
Dockercon Swarm Updated
 
Docker cluster with swarm, consul, registrator and consul-template
Docker cluster with swarm, consul, registrator and consul-templateDocker cluster with swarm, consul, registrator and consul-template
Docker cluster with swarm, consul, registrator and consul-template
 
Docker 1.12 & Swarm Mode [Montreal Docker Meetup Sept. 2016]
Docker 1.12 & Swarm Mode [Montreal Docker Meetup Sept. 2016]Docker 1.12 & Swarm Mode [Montreal Docker Meetup Sept. 2016]
Docker 1.12 & Swarm Mode [Montreal Docker Meetup Sept. 2016]
 
Docker swarm reloaded
Docker swarm reloadedDocker swarm reloaded
Docker swarm reloaded
 
Service Discovery & Load-Balancing under Docker 1.12.0 @ Docker Meetup #22
Service Discovery & Load-Balancing under Docker 1.12.0 @ Docker Meetup #22Service Discovery & Load-Balancing under Docker 1.12.0 @ Docker Meetup #22
Service Discovery & Load-Balancing under Docker 1.12.0 @ Docker Meetup #22
 

Andere mochten auch

Методы машинного обучения в физике элементарных частиц
Методы машинного обучения в физике элементарных частицМетоды машинного обучения в физике элементарных частиц
Методы машинного обучения в физике элементарных частицAndrey Ustyuzhanin
 
Azure container service overview
Azure container service overviewAzure container service overview
Azure container service overviewShabbir Akolawala
 
Kubernetes Mesos Architecture
Kubernetes Mesos ArchitectureKubernetes Mesos Architecture
Kubernetes Mesos ArchitectureYongbok Kim
 
Docker 1.12 - Swarm Mode
Docker 1.12 - Swarm ModeDocker 1.12 - Swarm Mode
Docker 1.12 - Swarm ModeRafael Gomes
 
Deploying and Scaling Microservices
Deploying and Scaling MicroservicesDeploying and Scaling Microservices
Deploying and Scaling MicroservicesSam Newman
 

Andere mochten auch (8)

Docker hands-on
Docker hands-onDocker hands-on
Docker hands-on
 
Методы машинного обучения в физике элементарных частиц
Методы машинного обучения в физике элементарных частицМетоды машинного обучения в физике элементарных частиц
Методы машинного обучения в физике элементарных частиц
 
Azure container service overview
Azure container service overviewAzure container service overview
Azure container service overview
 
Kubernetes Mesos Architecture
Kubernetes Mesos ArchitectureKubernetes Mesos Architecture
Kubernetes Mesos Architecture
 
Docker 1.12 - Swarm Mode
Docker 1.12 - Swarm ModeDocker 1.12 - Swarm Mode
Docker 1.12 - Swarm Mode
 
Docker Orchestrators
Docker OrchestratorsDocker Orchestrators
Docker Orchestrators
 
2017-03-11 01 Игорь Родионов. Docker swarm vs Kubernetes
2017-03-11 01 Игорь Родионов. Docker swarm vs Kubernetes2017-03-11 01 Игорь Родионов. Docker swarm vs Kubernetes
2017-03-11 01 Игорь Родионов. Docker swarm vs Kubernetes
 
Deploying and Scaling Microservices
Deploying and Scaling MicroservicesDeploying and Scaling Microservices
Deploying and Scaling Microservices
 

Ähnlich wie Swarm mode

Everything you need to know about Docker
Everything you need to know about DockerEverything you need to know about Docker
Everything you need to know about DockerAlican Akkuş
 
廣宣學堂: 容器進階實務 - Docker進深研究班
廣宣學堂: 容器進階實務 - Docker進深研究班廣宣學堂: 容器進階實務 - Docker進深研究班
廣宣學堂: 容器進階實務 - Docker進深研究班Paul Chao
 
Docker 進階實務班
Docker 進階實務班Docker 進階實務班
Docker 進階實務班Philip Zheng
 
Тарас Кирилюк — Docker basics. How-to for Drupal developers
Тарас Кирилюк — Docker basics. How-to for Drupal developersТарас Кирилюк — Docker basics. How-to for Drupal developers
Тарас Кирилюк — Docker basics. How-to for Drupal developersLEDC 2016
 
Orchestration of docker containers at scale
Orchestration of docker containers at scaleOrchestration of docker containers at scale
Orchestration of docker containers at scaleYeshwanth Kumar
 
Orchestrating Linux Containers while tolerating failures
Orchestrating Linux Containers while tolerating failuresOrchestrating Linux Containers while tolerating failures
Orchestrating Linux Containers while tolerating failuresDocker, Inc.
 
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 HajekPROIDEA
 
Docker Swarm and Traefik 2.0
Docker Swarm and Traefik 2.0Docker Swarm and Traefik 2.0
Docker Swarm and Traefik 2.0Jakub Hajek
 
Introction to docker swarm
Introction to docker swarmIntroction to docker swarm
Introction to docker swarmHsi-Kai Wang
 
Microservices with docker swarm and consul
Microservices with docker swarm and consulMicroservices with docker swarm and consul
Microservices with docker swarm and consulNguyen Sy Thanh Son
 
Killer Docker Workflows for Development
Killer Docker Workflows for DevelopmentKiller Docker Workflows for Development
Killer Docker Workflows for DevelopmentChris Tankersley
 
Introduction to Docker and Monitoring with InfluxData
Introduction to Docker and Monitoring with InfluxDataIntroduction to Docker and Monitoring with InfluxData
Introduction to Docker and Monitoring with InfluxDataInfluxData
 
Collabnix Online Webinar - Demystifying Docker & Kubernetes Networking by Bal...
Collabnix Online Webinar - Demystifying Docker & Kubernetes Networking by Bal...Collabnix Online Webinar - Demystifying Docker & Kubernetes Networking by Bal...
Collabnix Online Webinar - Demystifying Docker & Kubernetes Networking by Bal...Ajeet Singh Raina
 
Docker Essentials Workshop— Innovation Labs July 2020
Docker Essentials Workshop— Innovation Labs July 2020Docker Essentials Workshop— Innovation Labs July 2020
Docker Essentials Workshop— Innovation Labs July 2020CloudHero
 
Dockers & kubernetes detailed - Beginners to Geek
Dockers & kubernetes detailed - Beginners to GeekDockers & kubernetes detailed - Beginners to Geek
Dockers & kubernetes detailed - Beginners to GeekwiTTyMinds1
 
Docker workshop 0507 Taichung
Docker workshop 0507 Taichung Docker workshop 0507 Taichung
Docker workshop 0507 Taichung Paul Chao
 

Ähnlich wie Swarm mode (20)

Docker
DockerDocker
Docker
 
Everything you need to know about Docker
Everything you need to know about DockerEverything you need to know about Docker
Everything you need to know about Docker
 
Docker-machine
Docker-machineDocker-machine
Docker-machine
 
廣宣學堂: 容器進階實務 - Docker進深研究班
廣宣學堂: 容器進階實務 - Docker進深研究班廣宣學堂: 容器進階實務 - Docker進深研究班
廣宣學堂: 容器進階實務 - Docker進深研究班
 
Docker 進階實務班
Docker 進階實務班Docker 進階實務班
Docker 進階實務班
 
Тарас Кирилюк — Docker basics. How-to for Drupal developers
Тарас Кирилюк — Docker basics. How-to for Drupal developersТарас Кирилюк — Docker basics. How-to for Drupal developers
Тарас Кирилюк — Docker basics. How-to for Drupal developers
 
Orchestration of docker containers at scale
Orchestration of docker containers at scaleOrchestration of docker containers at scale
Orchestration of docker containers at scale
 
Demystfying container-networking
Demystfying container-networkingDemystfying container-networking
Demystfying container-networking
 
Orchestrating Linux Containers while tolerating failures
Orchestrating Linux Containers while tolerating failuresOrchestrating Linux Containers while tolerating failures
Orchestrating Linux Containers while tolerating failures
 
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
 
Docker linuxday 2015
Docker linuxday 2015Docker linuxday 2015
Docker linuxday 2015
 
Docker Swarm and Traefik 2.0
Docker Swarm and Traefik 2.0Docker Swarm and Traefik 2.0
Docker Swarm and Traefik 2.0
 
Introction to docker swarm
Introction to docker swarmIntroction to docker swarm
Introction to docker swarm
 
Microservices with docker swarm and consul
Microservices with docker swarm and consulMicroservices with docker swarm and consul
Microservices with docker swarm and consul
 
Killer Docker Workflows for Development
Killer Docker Workflows for DevelopmentKiller Docker Workflows for Development
Killer Docker Workflows for Development
 
Introduction to Docker and Monitoring with InfluxData
Introduction to Docker and Monitoring with InfluxDataIntroduction to Docker and Monitoring with InfluxData
Introduction to Docker and Monitoring with InfluxData
 
Collabnix Online Webinar - Demystifying Docker & Kubernetes Networking by Bal...
Collabnix Online Webinar - Demystifying Docker & Kubernetes Networking by Bal...Collabnix Online Webinar - Demystifying Docker & Kubernetes Networking by Bal...
Collabnix Online Webinar - Demystifying Docker & Kubernetes Networking by Bal...
 
Docker Essentials Workshop— Innovation Labs July 2020
Docker Essentials Workshop— Innovation Labs July 2020Docker Essentials Workshop— Innovation Labs July 2020
Docker Essentials Workshop— Innovation Labs July 2020
 
Dockers & kubernetes detailed - Beginners to Geek
Dockers & kubernetes detailed - Beginners to GeekDockers & kubernetes detailed - Beginners to Geek
Dockers & kubernetes detailed - Beginners to Geek
 
Docker workshop 0507 Taichung
Docker workshop 0507 Taichung Docker workshop 0507 Taichung
Docker workshop 0507 Taichung
 

Mehr von Dharmit Shah

Introducing CentOS container pipeline
Introducing CentOS container pipelineIntroducing CentOS container pipeline
Introducing CentOS container pipelineDharmit Shah
 
Introduction to Kubernetes
Introduction to KubernetesIntroduction to Kubernetes
Introduction to KubernetesDharmit Shah
 
Introduction to Containers
Introduction to ContainersIntroduction to Containers
Introduction to ContainersDharmit Shah
 
Git push to build, test and scan your containers
Git push to build, test and scan your containersGit push to build, test and scan your containers
Git push to build, test and scan your containersDharmit Shah
 
Python in Industry
Python in IndustryPython in Industry
Python in IndustryDharmit Shah
 
Introduction to ansible
Introduction to ansibleIntroduction to ansible
Introduction to ansibleDharmit Shah
 
Atomic Developer Bundle
Atomic Developer BundleAtomic Developer Bundle
Atomic Developer BundleDharmit Shah
 
Docker tips & tricks
Docker  tips & tricksDocker  tips & tricks
Docker tips & tricksDharmit Shah
 
Introducing docker
Introducing dockerIntroducing docker
Introducing dockerDharmit Shah
 
Rest apis with DRF
Rest apis with DRFRest apis with DRF
Rest apis with DRFDharmit Shah
 

Mehr von Dharmit Shah (12)

Introducing CentOS container pipeline
Introducing CentOS container pipelineIntroducing CentOS container pipeline
Introducing CentOS container pipeline
 
Introduction to Kubernetes
Introduction to KubernetesIntroduction to Kubernetes
Introduction to Kubernetes
 
Introduction to Containers
Introduction to ContainersIntroduction to Containers
Introduction to Containers
 
Git push to build, test and scan your containers
Git push to build, test and scan your containersGit push to build, test and scan your containers
Git push to build, test and scan your containers
 
Python in Industry
Python in IndustryPython in Industry
Python in Industry
 
Ansible in CI
Ansible in CIAnsible in CI
Ansible in CI
 
Introduction to ansible
Introduction to ansibleIntroduction to ansible
Introduction to ansible
 
Kubernetes
KubernetesKubernetes
Kubernetes
 
Atomic Developer Bundle
Atomic Developer BundleAtomic Developer Bundle
Atomic Developer Bundle
 
Docker tips & tricks
Docker  tips & tricksDocker  tips & tricks
Docker tips & tricks
 
Introducing docker
Introducing dockerIntroducing docker
Introducing docker
 
Rest apis with DRF
Rest apis with DRFRest apis with DRF
Rest apis with DRF
 

Kürzlich hochgeladen

Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
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 DiscoveryTrustArc
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
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 Takeoffsammart93
 
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 WorkerThousandEyes
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 

Kürzlich hochgeladen (20)

Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
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
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
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
 
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
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 

Swarm mode

  • 2. Who am I? ● Software Engineer @ Red Hat; developing developer tools ● Co-organizer of Docker and Ansible meetups ● Work on CentOS, Docker, Ansible, Vagrant, etc. ● Love vim, zsh, i3wm, and all things CLI ● dharmit on GitHub dharm1t on Twitter
  • 3. What is Swarm Mode? ● A mode built into Docker Engine ● Available with Docker 1.12 or later ● Lets you manage a cluster of Docker Engines ● Cluster of Docker Engines is called a swarm ● Use the familiar Docker CLI to create a swarm, deploy application services to a swarm, and manage swarm behavior. ● Swarm Mode != Swarm Kit
  • 4. Features ● Cluster management integrated with Docker Engine ● Can deploy Manager/Worker node using Docker Engine ● Declarative model to describe entire application stack ● Scale up or down based on requirements ● Constantly monitors and reconciles the cluster state ● Built in service discovery ● TLS auth and encryption for secure communication
  • 6. My Setup ● 2 VMs running on DigitalOcean ● 1 will run as manager ● 1 will run as worker ● Add 1 VM to work as manager
  • 7. Initialize a Swarm $ docker swarm init ● This command will initialize a swarm ● Docker Engine targeted by this command becomes a manager in the newly created single-node swarm ● Generates two random tokens - manager and worker tokens ● Use proper token to make a node join as worker or manager
  • 8. Add a node to Swarm $ docker swarm join --token <random-token-generated-by-previous-command> <ip-port-of-manager> This command will add a node to a Swarm as worker node $ docker swarm join-token manager This command will add a manager node to Swarm
  • 9. Create services $ docker service create --name redis redis:3.0.6 Creates a service named redis $ docker service create --name redis --replicas=5 redis:3.0.6 Creates a service redis with 5 replicas across the swarm $ docker service ls Lists the services in the cluster
  • 10. Replicated mode & Global mode $ docker service create --name redis --replicas=5 redis:3.0.6 Creates a service redis with 5 replicas across the swarm $ docker service create --name redis --mode global redis:3.0.6 Creates a global service with 1 container on each node
  • 11. Attach service to network $ docker network create --driver overlay my-network $ docker service create --replicas 3 --network my-network --name my-web nginx $ docker service ls Containers on the same network can access each other using service discovery
  • 12. Publish Service Ports $ docker service create --name my_web --replicas 3 --publish 8080:80 nginx Makes service accessible on port 8080 of every node regardless if there is a container running for that service on the node!
  • 13. Swarm Inspect $ docker service inspect nginx ● Provides JSON output ● Same as docker inspect for containers ● Should be run only on manager nodes
  • 14. Swarm Update ● Update an existing service $ docker service update --publish-add 6379:6379 redis Publishes redis service to port 6379 on all nodes in Swarm $ docker service update --image redis:latest redis Let’s watch the output of “$ docker service ps redis” Has many, many more options! Refer the docs.
  • 15. Scale a service $ docker service create --name redis redis:3.0.6 Creates a single container on a random node in the Swarm $ docker service scale redis=2 Starts another container on a random node
  • 16. ps, ls, rm, ● ps ○ List the tasks of a service ● ls ○ Lists the services in the swarm ● rm ○ Removes a service from the swarm
  • 17. References ● https://docs.docker.com ● Slideshare by Mike Goelzer and Andrea Luzzardi ● Docker Community Repo ● And some tinkering with containers…