SlideShare une entreprise Scribd logo
1  sur  30
Docker Clustering
batteries included, but removable
Jessie Frazelle @frazelledazzell Qcon London: March 5th
, 2015
InfoQ.com: News & Community Site
• 750,000 unique visitors/month
• Published in 4 languages (English, Chinese, Japanese and Brazilian
Portuguese)
• Post content from our QCon conferences
• News 15-20 / week
• Articles 3-4 / week
• Presentations (videos) 12-15 / week
• Interviews 2-3 / week
• Books 1 / month
Watch the video with slide
synchronization on InfoQ.com!
http://www.infoq.com/presentations
/docker-clustering
Presented at QCon London
www.qconlondon.com
Purpose of QCon
- to empower software development by facilitating the spread of
knowledge and innovation
Strategy
- practitioner-driven conference designed for YOU: influencers of
change and innovation in your teams
- speakers and topics driving the evolution and innovation
- connecting and catalyzing the influencers and innovators
Highlights
- attended by more than 12,000 delegates since 2007
- held in 9 cities worldwide
Outline
- Shortest ever intro to Docker
- Intro to Swarm (Docker clustering)
- Demo of Swarm
- Future of Swarm
What is Docker?
Docker is a runtime for containers.
Whoa what’s a container?
A container is a concept made from
linux namespaces, cgroups, & pivot
roots.
Outline
- Shortest ever intro to Docker
- Intro to Swarm (Docker clustering)
- Demo of Swarm
- Future of Swarm
Intro to Swarm
Native Clustering for Docker
Serves the standard Docker API
Transparently scale Docker API
consumers to multiple hosts
batteries included
but removable
Discovery
out-of-the-box
native discovery
options
etcd
consul
zookeeper
Schedulers
out-of-the-box
bin-packing (native)
options
random (native)
mesos (coming soon, in the works)
How to use Swarm
# installing swarm
$ docker pull swarm
# create a cluster
$ docker run --rm swarm create
6856663cdefdec325839a4b7e1de38e8 # <- unique <cluster_id>
# on each of your nodes, start the swarm agent
$ docker run -d swarm join 
--addr=<node_ip:2375> token://<cluster_id>
Minimal Image (small tangent)
A Whopping 7.19 MB
The Dockerfile -->
FROM scratch
COPY ./swarm /swarm
COPY ./certs/ca-certificates.crt
/etc/ssl/certs/ca-certificates.crt
ENV SWARM_HOST :2375
EXPOSE 2375
VOLUME /.swarm
ENTRYPOINT ["/swarm"]
CMD ["--help"]
How to use Swarm
# start the manager on any machine or your laptop
$ docker run -d -p <swarm_port>:2375 
swarm manage token://<cluster_id>
# list nodes in your cluster
$ docker run --rm 
swarm list token://<cluster_id> <node_ip:2375>
Using the Docker CLI + Swarm
# use the regular docker cli
$ export DOCKER_HOST=tcp://<swarm_ip:swarm_port>
$ docker info
$ docker ps
$ docker logs ...
# manage resources
$ docker run -m 1g
$ docker run -c 1
$ docker run -p 80:80
Constraints
# standard from docker info
# (storagedriver, executiondriver, kernelversion, operatingsystem)
$ docker run -e constraint:operatingsystem=debian ...
$ docker run -e constraint:storagedriver=btrfs ...
# custom with host labels
$ docker -d --label init=systemd ...
$ docker -d --label init=sysvinit ...
$ docker run -e constraint:init!=systemd ...
$ docker -d --label environment=production ...
$ docker run -e constraint:environment=production ...
Affinity
# containers
$ docker run -d --name web1 -p 80:80 nginx
$ docker run -d --name stats -e affinity:container==web1 stats
# images
$ docker run -d -e affinity:image==redis redis
$ docker run -d -e affinity:image==nginx nginx
Other Filters
# ports
$ docker run -d --name web1 -p 80:80 nginx
$ docker run -d --name web2 -p 80:80 nginx
^ defaults on different host
# dependency
$ docker run --volumes-from some-container ...
$ docker run --link some-container:alias ...
$ docker run --net container:some-container ...
Outline
- Shortest ever intro to Docker
- Intro to Swarm (Docker clustering)
- Demo of Swarm
- Future of Swarm
The Servers
Storage Drivers (medium tangent)
Ubuntu Host --> AUFS
Fedora Host --> Device Mapper
Debian Host --> Overlay
AUFS
- First storage driver implemented
- Ubuntu uses it in their default
kernel for Live CD
where root filesystem is COW (copy-on-write)
between CD/DVD/USB
Pitfalls: not in mainline kernel
Device Mapper
- Used by RedHat, default to Fedora
- In mainline kernel
- Creates “pools” of blocks
Each container & each image gets its own block device
- Each time a new block (or a copy-on-
write block) is written, a block is
allocated from the pool
Device Mapper
Pitfalls: By default, Docker puts data
and metadata on a loop device backed
by a sparse file
Which is cool but has terrible performance.
Each time a container writes to a new block...
a block has to be allocated from the pool...
and when it's written to...
a block has to be allocated from the sparse file...
and sparse file performance is not the greatest
Overlay
- The hero we all deserve
- In mainline kernel (>=3.18)
- works a lot like AUFS in that it
does not need its own partition and
works out-of-the-box
Pitfalls: requires kernel >= 3.18
BTRFS (not used for demo, but important)
- In mainline kernel
- Does copy-on-write at filesystem
level
integrates the snapshot and block pool management features
at the filesystem level, instead of the block device level
Pitfalls: have to setup partition
Back to the demo...
Outline
- Shortest ever intro to Docker
- Intro to Swarm (Docker clustering)
- Demo of Swarm
- Future of Swarm
Future of Swarm
- Rescheduling Policies
- More backend drivers, Mesos, etc
- Leader Election (Distributed State)
- Keeping up to date feature-wise with
things added to the engine
Fin.
Jessie Frazelle @frazelledazzell jess@docker.com
Watch the video with slide synchronization on
InfoQ.com!
http://www.infoq.com/presentations/docker-
clustering

Contenu connexe

Tendances

Tendances (20)

Building a Docker v1.12 Swarm cluster on ARM
Building a Docker v1.12 Swarm cluster on ARMBuilding a Docker v1.12 Swarm cluster on ARM
Building a Docker v1.12 Swarm cluster on ARM
 
GDG Lima - Docker Compose
GDG Lima - Docker ComposeGDG Lima - Docker Compose
GDG Lima - Docker Compose
 
Dockerize your Symfony application - Symfony Live NYC 2014
Dockerize your Symfony application - Symfony Live NYC 2014Dockerize your Symfony application - Symfony Live NYC 2014
Dockerize your Symfony application - Symfony Live NYC 2014
 
The state of the swarm
The state of the swarmThe state of the swarm
The state of the swarm
 
Using docker to develop NAS applications
Using docker to develop NAS applicationsUsing docker to develop NAS applications
Using docker to develop NAS applications
 
Docker 初探,實驗室中的運貨鯨
Docker 初探,實驗室中的運貨鯨Docker 初探,實驗室中的運貨鯨
Docker 初探,實驗室中的運貨鯨
 
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
 
Docker orchestration
Docker orchestrationDocker orchestration
Docker orchestration
 
Rapid Development With Docker Compose
Rapid Development With Docker ComposeRapid Development With Docker Compose
Rapid Development With Docker Compose
 
Perspectives on Docker
Perspectives on DockerPerspectives on Docker
Perspectives on Docker
 
Plug-ins: Building, Shipping, Storing, and Running - Nandhini Santhanam and T...
Plug-ins: Building, Shipping, Storing, and Running - Nandhini Santhanam and T...Plug-ins: Building, Shipping, Storing, and Running - Nandhini Santhanam and T...
Plug-ins: Building, Shipping, Storing, and Running - Nandhini Santhanam and T...
 
Exploring Docker Security
Exploring Docker SecurityExploring Docker Security
Exploring Docker Security
 
Puppet and Vagrant in development
Puppet and Vagrant in developmentPuppet and Vagrant in development
Puppet and Vagrant in development
 
Docker 原理與實作
Docker 原理與實作Docker 原理與實作
Docker 原理與實作
 
Azure container service docker-ha noi com
Azure container service   docker-ha noi comAzure container service   docker-ha noi com
Azure container service docker-ha noi com
 
Dockerizing a Symfony2 application
Dockerizing a Symfony2 applicationDockerizing a Symfony2 application
Dockerizing a Symfony2 application
 
Docker 1.11 Presentation
Docker 1.11 PresentationDocker 1.11 Presentation
Docker 1.11 Presentation
 
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
 
Docker 101 - from 0 to Docker in 30 minutes
Docker 101 - from 0 to Docker in 30 minutesDocker 101 - from 0 to Docker in 30 minutes
Docker 101 - from 0 to Docker in 30 minutes
 
Introduction to docker
Introduction to dockerIntroduction to docker
Introduction to docker
 

Similaire à Docker Clustering - Batteries Included

Automate drupal deployments with linux containers, docker and vagrant
Automate drupal deployments with linux containers, docker and vagrant Automate drupal deployments with linux containers, docker and vagrant
Automate drupal deployments with linux containers, docker and vagrant
Ricardo Amaro
 
Be a Happier Developer with Docker: Tricks of the Trade
Be a Happier Developer with Docker: Tricks of the TradeBe a Happier Developer with Docker: Tricks of the Trade
Be a Happier Developer with Docker: Tricks of the Trade
Docker, Inc.
 

Similaire à Docker Clustering - Batteries Included (20)

Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)Running Docker in Development & Production (DevSum 2015)
Running Docker in Development & Production (DevSum 2015)
 
Real World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and ProductionReal World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and Production
 
Running the Oracle SOA Suite Environment in a Docker Container
Running the Oracle SOA Suite Environment in a Docker ContainerRunning the Oracle SOA Suite Environment in a Docker Container
Running the Oracle SOA Suite Environment in a Docker Container
 
Introducing Docker
Introducing DockerIntroducing Docker
Introducing Docker
 
DCSF 19 Building Your Development Pipeline
DCSF 19 Building Your Development Pipeline  DCSF 19 Building Your Development Pipeline
DCSF 19 Building Your Development Pipeline
 
codemotion-docker-2014
codemotion-docker-2014codemotion-docker-2014
codemotion-docker-2014
 
Why everyone is excited about Docker (and you should too...) - Carlo Bonamic...
Why everyone is excited about Docker (and you should too...) -  Carlo Bonamic...Why everyone is excited about Docker (and you should too...) -  Carlo Bonamic...
Why everyone is excited about Docker (and you should too...) - Carlo Bonamic...
 
[Codelab 2017] Docker 기초 및 활용 방안
[Codelab 2017] Docker 기초 및 활용 방안[Codelab 2017] Docker 기초 및 활용 방안
[Codelab 2017] Docker 기초 및 활용 방안
 
Introduction to Docker
Introduction  to DockerIntroduction  to Docker
Introduction to Docker
 
Be a happier developer with Docker: Tricks of the trade
Be a happier developer with Docker: Tricks of the tradeBe a happier developer with Docker: Tricks of the trade
Be a happier developer with Docker: Tricks of the trade
 
The Dockerfile Explosion and the Need for Higher Level Tools by Gareth Rushgrove
The Dockerfile Explosion and the Need for Higher Level Tools by Gareth RushgroveThe Dockerfile Explosion and the Need for Higher Level Tools by Gareth Rushgrove
The Dockerfile Explosion and the Need for Higher Level Tools by Gareth Rushgrove
 
Automate drupal deployments with linux containers, docker and vagrant
Automate drupal deployments with linux containers, docker and vagrant Automate drupal deployments with linux containers, docker and vagrant
Automate drupal deployments with linux containers, docker and vagrant
 
DCEU 18: Building Your Development Pipeline
DCEU 18: Building Your Development PipelineDCEU 18: Building Your Development Pipeline
DCEU 18: Building Your Development Pipeline
 
BBL Premiers pas avec Docker
BBL Premiers pas avec DockerBBL Premiers pas avec Docker
BBL Premiers pas avec Docker
 
Docker Security workshop slides
Docker Security workshop slidesDocker Security workshop slides
Docker Security workshop slides
 
Delivering Docker & K3s worloads to IoT Edge devices
Delivering Docker & K3s worloads to IoT Edge devicesDelivering Docker & K3s worloads to IoT Edge devices
Delivering Docker & K3s worloads to IoT Edge devices
 
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
 
ContainerDayVietnam2016: Dockerize a small business
ContainerDayVietnam2016: Dockerize a small businessContainerDayVietnam2016: Dockerize a small business
ContainerDayVietnam2016: Dockerize a small business
 
Be a Happier Developer with Docker: Tricks of the Trade
Be a Happier Developer with Docker: Tricks of the TradeBe a Happier Developer with Docker: Tricks of the Trade
Be a Happier Developer with Docker: Tricks of the Trade
 
ExpoQA 2017 Using docker to build and test in your laptop and Jenkins
ExpoQA 2017 Using docker to build and test in your laptop and JenkinsExpoQA 2017 Using docker to build and test in your laptop and Jenkins
ExpoQA 2017 Using docker to build and test in your laptop and Jenkins
 

Plus de C4Media

Plus de C4Media (20)

Streaming a Million Likes/Second: Real-Time Interactions on Live Video
Streaming a Million Likes/Second: Real-Time Interactions on Live VideoStreaming a Million Likes/Second: Real-Time Interactions on Live Video
Streaming a Million Likes/Second: Real-Time Interactions on Live Video
 
Next Generation Client APIs in Envoy Mobile
Next Generation Client APIs in Envoy MobileNext Generation Client APIs in Envoy Mobile
Next Generation Client APIs in Envoy Mobile
 
Software Teams and Teamwork Trends Report Q1 2020
Software Teams and Teamwork Trends Report Q1 2020Software Teams and Teamwork Trends Report Q1 2020
Software Teams and Teamwork Trends Report Q1 2020
 
Understand the Trade-offs Using Compilers for Java Applications
Understand the Trade-offs Using Compilers for Java ApplicationsUnderstand the Trade-offs Using Compilers for Java Applications
Understand the Trade-offs Using Compilers for Java Applications
 
Kafka Needs No Keeper
Kafka Needs No KeeperKafka Needs No Keeper
Kafka Needs No Keeper
 
High Performing Teams Act Like Owners
High Performing Teams Act Like OwnersHigh Performing Teams Act Like Owners
High Performing Teams Act Like Owners
 
Does Java Need Inline Types? What Project Valhalla Can Bring to Java
Does Java Need Inline Types? What Project Valhalla Can Bring to JavaDoes Java Need Inline Types? What Project Valhalla Can Bring to Java
Does Java Need Inline Types? What Project Valhalla Can Bring to Java
 
Service Meshes- The Ultimate Guide
Service Meshes- The Ultimate GuideService Meshes- The Ultimate Guide
Service Meshes- The Ultimate Guide
 
Shifting Left with Cloud Native CI/CD
Shifting Left with Cloud Native CI/CDShifting Left with Cloud Native CI/CD
Shifting Left with Cloud Native CI/CD
 
CI/CD for Machine Learning
CI/CD for Machine LearningCI/CD for Machine Learning
CI/CD for Machine Learning
 
Fault Tolerance at Speed
Fault Tolerance at SpeedFault Tolerance at Speed
Fault Tolerance at Speed
 
Architectures That Scale Deep - Regaining Control in Deep Systems
Architectures That Scale Deep - Regaining Control in Deep SystemsArchitectures That Scale Deep - Regaining Control in Deep Systems
Architectures That Scale Deep - Regaining Control in Deep Systems
 
ML in the Browser: Interactive Experiences with Tensorflow.js
ML in the Browser: Interactive Experiences with Tensorflow.jsML in the Browser: Interactive Experiences with Tensorflow.js
ML in the Browser: Interactive Experiences with Tensorflow.js
 
Build Your Own WebAssembly Compiler
Build Your Own WebAssembly CompilerBuild Your Own WebAssembly Compiler
Build Your Own WebAssembly Compiler
 
User & Device Identity for Microservices @ Netflix Scale
User & Device Identity for Microservices @ Netflix ScaleUser & Device Identity for Microservices @ Netflix Scale
User & Device Identity for Microservices @ Netflix Scale
 
Scaling Patterns for Netflix's Edge
Scaling Patterns for Netflix's EdgeScaling Patterns for Netflix's Edge
Scaling Patterns for Netflix's Edge
 
Make Your Electron App Feel at Home Everywhere
Make Your Electron App Feel at Home EverywhereMake Your Electron App Feel at Home Everywhere
Make Your Electron App Feel at Home Everywhere
 
The Talk You've Been Await-ing For
The Talk You've Been Await-ing ForThe Talk You've Been Await-ing For
The Talk You've Been Await-ing For
 
Future of Data Engineering
Future of Data EngineeringFuture of Data Engineering
Future of Data Engineering
 
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and MoreAutomated Testing for Terraform, Docker, Packer, Kubernetes, and More
Automated Testing for Terraform, Docker, Packer, Kubernetes, and More
 

Dernier

+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...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Dernier (20)

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...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
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
 
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
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
+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...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
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...
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 

Docker Clustering - Batteries Included

  • 1. Docker Clustering batteries included, but removable Jessie Frazelle @frazelledazzell Qcon London: March 5th , 2015
  • 2. InfoQ.com: News & Community Site • 750,000 unique visitors/month • Published in 4 languages (English, Chinese, Japanese and Brazilian Portuguese) • Post content from our QCon conferences • News 15-20 / week • Articles 3-4 / week • Presentations (videos) 12-15 / week • Interviews 2-3 / week • Books 1 / month Watch the video with slide synchronization on InfoQ.com! http://www.infoq.com/presentations /docker-clustering
  • 3. Presented at QCon London www.qconlondon.com Purpose of QCon - to empower software development by facilitating the spread of knowledge and innovation Strategy - practitioner-driven conference designed for YOU: influencers of change and innovation in your teams - speakers and topics driving the evolution and innovation - connecting and catalyzing the influencers and innovators Highlights - attended by more than 12,000 delegates since 2007 - held in 9 cities worldwide
  • 4. Outline - Shortest ever intro to Docker - Intro to Swarm (Docker clustering) - Demo of Swarm - Future of Swarm
  • 5. What is Docker? Docker is a runtime for containers. Whoa what’s a container? A container is a concept made from linux namespaces, cgroups, & pivot roots.
  • 6. Outline - Shortest ever intro to Docker - Intro to Swarm (Docker clustering) - Demo of Swarm - Future of Swarm
  • 7. Intro to Swarm Native Clustering for Docker Serves the standard Docker API Transparently scale Docker API consumers to multiple hosts
  • 11. How to use Swarm # installing swarm $ docker pull swarm # create a cluster $ docker run --rm swarm create 6856663cdefdec325839a4b7e1de38e8 # <- unique <cluster_id> # on each of your nodes, start the swarm agent $ docker run -d swarm join --addr=<node_ip:2375> token://<cluster_id>
  • 12. Minimal Image (small tangent) A Whopping 7.19 MB The Dockerfile --> FROM scratch COPY ./swarm /swarm COPY ./certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt ENV SWARM_HOST :2375 EXPOSE 2375 VOLUME /.swarm ENTRYPOINT ["/swarm"] CMD ["--help"]
  • 13. How to use Swarm # start the manager on any machine or your laptop $ docker run -d -p <swarm_port>:2375 swarm manage token://<cluster_id> # list nodes in your cluster $ docker run --rm swarm list token://<cluster_id> <node_ip:2375>
  • 14. Using the Docker CLI + Swarm # use the regular docker cli $ export DOCKER_HOST=tcp://<swarm_ip:swarm_port> $ docker info $ docker ps $ docker logs ... # manage resources $ docker run -m 1g $ docker run -c 1 $ docker run -p 80:80
  • 15. Constraints # standard from docker info # (storagedriver, executiondriver, kernelversion, operatingsystem) $ docker run -e constraint:operatingsystem=debian ... $ docker run -e constraint:storagedriver=btrfs ... # custom with host labels $ docker -d --label init=systemd ... $ docker -d --label init=sysvinit ... $ docker run -e constraint:init!=systemd ... $ docker -d --label environment=production ... $ docker run -e constraint:environment=production ...
  • 16. Affinity # containers $ docker run -d --name web1 -p 80:80 nginx $ docker run -d --name stats -e affinity:container==web1 stats # images $ docker run -d -e affinity:image==redis redis $ docker run -d -e affinity:image==nginx nginx
  • 17. Other Filters # ports $ docker run -d --name web1 -p 80:80 nginx $ docker run -d --name web2 -p 80:80 nginx ^ defaults on different host # dependency $ docker run --volumes-from some-container ... $ docker run --link some-container:alias ... $ docker run --net container:some-container ...
  • 18. Outline - Shortest ever intro to Docker - Intro to Swarm (Docker clustering) - Demo of Swarm - Future of Swarm
  • 20. Storage Drivers (medium tangent) Ubuntu Host --> AUFS Fedora Host --> Device Mapper Debian Host --> Overlay
  • 21. AUFS - First storage driver implemented - Ubuntu uses it in their default kernel for Live CD where root filesystem is COW (copy-on-write) between CD/DVD/USB Pitfalls: not in mainline kernel
  • 22. Device Mapper - Used by RedHat, default to Fedora - In mainline kernel - Creates “pools” of blocks Each container & each image gets its own block device - Each time a new block (or a copy-on- write block) is written, a block is allocated from the pool
  • 23. Device Mapper Pitfalls: By default, Docker puts data and metadata on a loop device backed by a sparse file Which is cool but has terrible performance. Each time a container writes to a new block... a block has to be allocated from the pool... and when it's written to... a block has to be allocated from the sparse file... and sparse file performance is not the greatest
  • 24. Overlay - The hero we all deserve - In mainline kernel (>=3.18) - works a lot like AUFS in that it does not need its own partition and works out-of-the-box Pitfalls: requires kernel >= 3.18
  • 25. BTRFS (not used for demo, but important) - In mainline kernel - Does copy-on-write at filesystem level integrates the snapshot and block pool management features at the filesystem level, instead of the block device level Pitfalls: have to setup partition
  • 26. Back to the demo...
  • 27. Outline - Shortest ever intro to Docker - Intro to Swarm (Docker clustering) - Demo of Swarm - Future of Swarm
  • 28. Future of Swarm - Rescheduling Policies - More backend drivers, Mesos, etc - Leader Election (Distributed State) - Keeping up to date feature-wise with things added to the engine
  • 30. Watch the video with slide synchronization on InfoQ.com! http://www.infoq.com/presentations/docker- clustering