Docker:
Everything you
should know
1 / 35
Who am I?
Aaron Huslage (@huslage)
Sysadmin since 1993
Since April 2014: Solution Engineer @ Docker
2 / 35
Outline
Why Docker?
What's Docker?
How to get started?
3 / 35
Why Docker?
4 / 35
Why Docker?
Faster application development cycle
Multiplication of environments
Scaling requirements
5 / 35
Yesterday: slow cycles (months/years)
Specification
Implementation
Validation
Release
Maintenance
6 / 35
Today: fast cycles (weeks/days)
Minimum Viable Product
Short iterations (sprints)
Continuous Deployment
A project is never "done" or "over"
Agile methods
7 / 35
Yesterday: single environment
One language
One framework
One database
One server
(+ sometimes a dev environment)
8 / 35
Today: many environments
Many languages
Polyglot platforms
Simultaneous use of SQL, NoSQL ...
The right tool for the right job
Many servers
(everybody has their local dev env;
there are many envs for testing, CI, QA, etc.)
9 / 35
Yesterday: slow, vertical deployment
New versions once in a while
Installed to few servers (sometimes just one)
Scaling = scaling up (you're gonna need a bigger server)
Scaling must be planned far ahead
10 / 35
Today: rapid, horizontal deployment
New versions all the time
(every week / day / hour)
Installed to many servers
Scaling = scaling out (MOAR servers!)
Need to be able to scale quickly
11 / 35
What is Docker?
12 / 35
What is Docker?
Container execution engine
Container build system
Container image distribution
Ginormous ecosystem
13 / 35
Container execution engine
~Hypervisor for containers
Container =~ lightweight virtual machine
... What is a container???
14 / 35
15 / 35
Container
It looks and feels like a VM
Standard UNIX processes, isolated by kernel mechanisms:
namespaces
cgroups (control groups)
copy-on-write
Insanely fast boot times
Insanely low resource usage
16 / 35
Build system
Dockerfile= recipe describing the build process
Easy to learn (similar to shell scripting)
Fast (caching system)
Reliable, reproducible
17 / 35
Build system
Dockerfile= recipe describing the build process
Easy to learn (similar to shell scripting)
Fast (caching system)
Reliable, reproducible
Let's have our cake - and eat it too
(Compared to classic scripting, or configuration
management systems like Puppet, Chef, Salt, Ansible...)
18 / 35
19 / 35
Image format
Problem: VM images are big
Solution 1: container images are smaller
doesn't need hardware support, kernel, drivers ...
separate handling of logs, metrics, backups ...
Solution 2: images broken down into layers
1 layer = 1 build step
example: base system, packages, code, config
only transfer updated layers
20 / 35
Distribution protocol
Problem: it's both too simple and too complicated
"just do taror rsync...
21 / 35
Distribution protocol
Problem: it's both too simple and too complicated
"just do taror rsync...
... with these 5 cryptic options, and it works"
22 / 35
Distribution protocol
Problem: it's both too simple and too complicated
"just do taror rsync...
... with these 5 cryptic options, and it works"
(mostly)
23 / 35
Distribution protocol
Problem: it's both too simple and too complicated
"just do taror rsync...
... with these 5 cryptic options, and it works"
(mostly)
Solution: Docker Registry
transfer layers via an open REST API
open source reference implementation
free service for public images
(à la GitHub)
24 / 35
25 / 35
Ecosystem: images
~100 official images
Linux distros
(Debian, Ubuntu, CentOS, Fedora, ...)
components
(MySQL, Redis, PostgreSQL, MongoDB, NGINX...)
languages
(Python, Ruby, Java, Go, Node...)
applications
(Wordpress...)
~150,000 contributed images
26 / 35
Ecosystem: code
~100,000 GitHub repositories have a Dockerfile
~1000 contributors to Docker code
Thousands of projects integrating with Docker
Some official tools:
Machine (deploy Docker hosts)
Compose (manage multi-container applications)
Swarm (cluster multiple Docker hosts together)
27 / 35
One example: Docker Compose
Assemble application from multiple containers
Define parameters of each container
how to build it
how to run it
(command, arguments, environment...)
network port mappings
linking between containers
28 / 35
29 / 35
How to get
started?
30 / 35
If you're in a hurry
OS X, Windows: Docker Toolbox + boot2docker
tiny VM image (less than 30 MB)
works on (most) physical and virtual machines
Linux: get.docker.com
shell script
usable with Cloud Init or |sh*
* Make sure you use https and nobody gets hurt!
31 / 35
If you like reading
docs.docker.com
start with "get started" (duh!)
(it's written in good old "howto" style)
reference documentations
32 / 35
If you like looking at / listening to
training.docker.com
Free, official training videos
Intro to Docker
(general concepts)
Docker Fundamentals
(first steps with Docker)
Docker Operations
(using Machine, Swarm, Compose)
33 / 35
How to "Dockerize" my app?
1. Write a Dockerfilefor the main component
2. Write a docker-compose.ymlfor the app itself
3. Use Docker+Compose during development
4. Use Docker+Compose for testing/QA/acceptance...
5. (Optionally) setup CI/CD
6. Go to production with Docker+Compose
(static resource scheduling)
If you have 100s of apps with 100s of containers (each):
setup a self-service container platform for your developers
(using e.g. Swarm, Mesos, Kubernetes...)
34 / 35
Questions?
@huslage
@docker
35 / 35

All Things Open 2015: DOCKER: EVERYTHING YOU SHOULD KNOW

  • 1.
  • 2.
    Who am I? AaronHuslage (@huslage) Sysadmin since 1993 Since April 2014: Solution Engineer @ Docker 2 / 35
  • 3.
  • 4.
  • 5.
    Why Docker? Faster applicationdevelopment cycle Multiplication of environments Scaling requirements 5 / 35
  • 6.
    Yesterday: slow cycles(months/years) Specification Implementation Validation Release Maintenance 6 / 35
  • 7.
    Today: fast cycles(weeks/days) Minimum Viable Product Short iterations (sprints) Continuous Deployment A project is never "done" or "over" Agile methods 7 / 35
  • 8.
    Yesterday: single environment Onelanguage One framework One database One server (+ sometimes a dev environment) 8 / 35
  • 9.
    Today: many environments Manylanguages Polyglot platforms Simultaneous use of SQL, NoSQL ... The right tool for the right job Many servers (everybody has their local dev env; there are many envs for testing, CI, QA, etc.) 9 / 35
  • 10.
    Yesterday: slow, verticaldeployment New versions once in a while Installed to few servers (sometimes just one) Scaling = scaling up (you're gonna need a bigger server) Scaling must be planned far ahead 10 / 35
  • 11.
    Today: rapid, horizontaldeployment New versions all the time (every week / day / hour) Installed to many servers Scaling = scaling out (MOAR servers!) Need to be able to scale quickly 11 / 35
  • 12.
  • 13.
    What is Docker? Containerexecution engine Container build system Container image distribution Ginormous ecosystem 13 / 35
  • 14.
    Container execution engine ~Hypervisorfor containers Container =~ lightweight virtual machine ... What is a container??? 14 / 35
  • 15.
  • 16.
    Container It looks andfeels like a VM Standard UNIX processes, isolated by kernel mechanisms: namespaces cgroups (control groups) copy-on-write Insanely fast boot times Insanely low resource usage 16 / 35
  • 17.
    Build system Dockerfile= recipedescribing the build process Easy to learn (similar to shell scripting) Fast (caching system) Reliable, reproducible 17 / 35
  • 18.
    Build system Dockerfile= recipedescribing the build process Easy to learn (similar to shell scripting) Fast (caching system) Reliable, reproducible Let's have our cake - and eat it too (Compared to classic scripting, or configuration management systems like Puppet, Chef, Salt, Ansible...) 18 / 35
  • 19.
  • 20.
    Image format Problem: VMimages are big Solution 1: container images are smaller doesn't need hardware support, kernel, drivers ... separate handling of logs, metrics, backups ... Solution 2: images broken down into layers 1 layer = 1 build step example: base system, packages, code, config only transfer updated layers 20 / 35
  • 21.
    Distribution protocol Problem: it'sboth too simple and too complicated "just do taror rsync... 21 / 35
  • 22.
    Distribution protocol Problem: it'sboth too simple and too complicated "just do taror rsync... ... with these 5 cryptic options, and it works" 22 / 35
  • 23.
    Distribution protocol Problem: it'sboth too simple and too complicated "just do taror rsync... ... with these 5 cryptic options, and it works" (mostly) 23 / 35
  • 24.
    Distribution protocol Problem: it'sboth too simple and too complicated "just do taror rsync... ... with these 5 cryptic options, and it works" (mostly) Solution: Docker Registry transfer layers via an open REST API open source reference implementation free service for public images (à la GitHub) 24 / 35
  • 25.
  • 26.
    Ecosystem: images ~100 officialimages Linux distros (Debian, Ubuntu, CentOS, Fedora, ...) components (MySQL, Redis, PostgreSQL, MongoDB, NGINX...) languages (Python, Ruby, Java, Go, Node...) applications (Wordpress...) ~150,000 contributed images 26 / 35
  • 27.
    Ecosystem: code ~100,000 GitHubrepositories have a Dockerfile ~1000 contributors to Docker code Thousands of projects integrating with Docker Some official tools: Machine (deploy Docker hosts) Compose (manage multi-container applications) Swarm (cluster multiple Docker hosts together) 27 / 35
  • 28.
    One example: DockerCompose Assemble application from multiple containers Define parameters of each container how to build it how to run it (command, arguments, environment...) network port mappings linking between containers 28 / 35
  • 29.
  • 30.
  • 31.
    If you're ina hurry OS X, Windows: Docker Toolbox + boot2docker tiny VM image (less than 30 MB) works on (most) physical and virtual machines Linux: get.docker.com shell script usable with Cloud Init or |sh* * Make sure you use https and nobody gets hurt! 31 / 35
  • 32.
    If you likereading docs.docker.com start with "get started" (duh!) (it's written in good old "howto" style) reference documentations 32 / 35
  • 33.
    If you likelooking at / listening to training.docker.com Free, official training videos Intro to Docker (general concepts) Docker Fundamentals (first steps with Docker) Docker Operations (using Machine, Swarm, Compose) 33 / 35
  • 34.
    How to "Dockerize"my app? 1. Write a Dockerfilefor the main component 2. Write a docker-compose.ymlfor the app itself 3. Use Docker+Compose during development 4. Use Docker+Compose for testing/QA/acceptance... 5. (Optionally) setup CI/CD 6. Go to production with Docker+Compose (static resource scheduling) If you have 100s of apps with 100s of containers (each): setup a self-service container platform for your developers (using e.g. Swarm, Mesos, Kubernetes...) 34 / 35
  • 35.