SlideShare a Scribd company logo
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

More Related Content

PPTX
Hide your development environment and application in a container
PDF
Docker 101 @KACST Saudi HPC 2016
PDF
Docker Compose to Production with Docker Swarm
PDF
Docker at Flux7
PDF
dockerizing web application
PPTX
Docker - Demo on PHP Application deployment
PDF
Introduction to docker security
PPTX
Docker workshop DevOpsDays Amsterdam 2014
Hide your development environment and application in a container
Docker 101 @KACST Saudi HPC 2016
Docker Compose to Production with Docker Swarm
Docker at Flux7
dockerizing web application
Docker - Demo on PHP Application deployment
Introduction to docker security
Docker workshop DevOpsDays Amsterdam 2014

What's hot (20)

PPTX
Building a Docker v1.12 Swarm cluster on ARM
PDF
GDG Lima - Docker Compose
PDF
Dockerize your Symfony application - Symfony Live NYC 2014
PDF
The state of the swarm
PDF
Using docker to develop NAS applications
PDF
Docker 初探,實驗室中的運貨鯨
PDF
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
PPTX
Docker orchestration
PDF
Rapid Development With Docker Compose
PDF
Perspectives on Docker
PDF
Plug-ins: Building, Shipping, Storing, and Running - Nandhini Santhanam and T...
PPTX
Exploring Docker Security
PDF
Puppet and Vagrant in development
PDF
Docker 原理與實作
PPTX
Azure container service docker-ha noi com
PPTX
Dockerizing a Symfony2 application
PPTX
Docker 1.11 Presentation
PPTX
Docker Networking - Common Issues and Troubleshooting Techniques
PDF
Docker 101 - from 0 to Docker in 30 minutes
PDF
Introduction to docker
Building a Docker v1.12 Swarm cluster on ARM
GDG Lima - Docker Compose
Dockerize your Symfony application - Symfony Live NYC 2014
The state of the swarm
Using docker to develop NAS applications
Docker 初探,實驗室中的運貨鯨
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
Docker orchestration
Rapid Development With Docker Compose
Perspectives on Docker
Plug-ins: Building, Shipping, Storing, and Running - Nandhini Santhanam and T...
Exploring Docker Security
Puppet and Vagrant in development
Docker 原理與實作
Azure container service docker-ha noi com
Dockerizing a Symfony2 application
Docker 1.11 Presentation
Docker Networking - Common Issues and Troubleshooting Techniques
Docker 101 - from 0 to Docker in 30 minutes
Introduction to docker
Ad

Similar to Docker Clustering - Batteries Included (20)

PDF
Going Production with Docker and Swarm
PPTX
Introducing Docker Swarm - the orchestration tool by Docker
PDF
Introduction to Docker and Monitoring with InfluxData
PDF
Taking Docker to Production: What You Need to Know and Decide
PDF
Taking Docker to Production: What You Need to Know and Decide
PDF
Docker HK Meetup - 201707
PPTX
Docker for the new Era: Introducing Docker,its components and tools
PDF
Journey to Docker Production: Evolving Your Infrastructure and Processes - Br...
PPTX
Introduction To Docker, Docker Compose, Docker Swarm
PDF
Swarm: Native Docker Clustering
PDF
Docker Essentials Workshop— Innovation Labs July 2020
PPTX
Introducing & playing with Docker | Manel Martinez | 1st Docker Crete Meetup
PDF
Docker n co
PDF
Docker 1.9 Workshop
ODP
Docker and stuff
PPTX
Docker Swarm for Beginner
PDF
Dockertaipei 20150528-dockerswarm
PDF
Docker Introduction
PDF
PDF
DockerDay2015: Docker orchestration for sysadmin
Going Production with Docker and Swarm
Introducing Docker Swarm - the orchestration tool by Docker
Introduction to Docker and Monitoring with InfluxData
Taking Docker to Production: What You Need to Know and Decide
Taking Docker to Production: What You Need to Know and Decide
Docker HK Meetup - 201707
Docker for the new Era: Introducing Docker,its components and tools
Journey to Docker Production: Evolving Your Infrastructure and Processes - Br...
Introduction To Docker, Docker Compose, Docker Swarm
Swarm: Native Docker Clustering
Docker Essentials Workshop— Innovation Labs July 2020
Introducing & playing with Docker | Manel Martinez | 1st Docker Crete Meetup
Docker n co
Docker 1.9 Workshop
Docker and stuff
Docker Swarm for Beginner
Dockertaipei 20150528-dockerswarm
Docker Introduction
DockerDay2015: Docker orchestration for sysadmin
Ad

More from C4Media (20)

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

Recently uploaded (20)

PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Modernizing your data center with Dell and AMD
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Approach and Philosophy of On baking technology
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Big Data Technologies - Introduction.pptx
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPT
Teaching material agriculture food technology
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
A Presentation on Artificial Intelligence
Advanced methodologies resolving dimensionality complications for autism neur...
20250228 LYD VKU AI Blended-Learning.pptx
Modernizing your data center with Dell and AMD
MYSQL Presentation for SQL database connectivity
Building Integrated photovoltaic BIPV_UPV.pdf
The AUB Centre for AI in Media Proposal.docx
Per capita expenditure prediction using model stacking based on satellite ima...
NewMind AI Weekly Chronicles - August'25 Week I
Network Security Unit 5.pdf for BCA BBA.
Approach and Philosophy of On baking technology
Encapsulation_ Review paper, used for researhc scholars
Agricultural_Statistics_at_a_Glance_2022_0.pdf
NewMind AI Monthly Chronicles - July 2025
Review of recent advances in non-invasive hemoglobin estimation
Mobile App Security Testing_ A Comprehensive Guide.pdf
Big Data Technologies - Introduction.pptx
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Teaching material agriculture food technology
Spectral efficient network and resource selection model in 5G networks
A Presentation on Artificial Intelligence

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