Introduction to Docker
Contents
Introduction to Docker and containers

Docker v VM’s
Q&A
Demo
Docker Timeline
January 2013 Docker started as internal project inside dotCloud

March 2013 Docker released to public
February 2014 Docker 0.8 released
Production ready at 1.0
In the 7 months since we launched
•
•
•
•

>140,000 container pulls
>6,700 github stars
>180 non-employee contributors
>150 projects built on top of docker
• UIs, mini-PaaS, Remote Desktop….

• 1000’s of Dockerized applications
• Memcached, Redis, Node.js…and Hadoop

• Integration in
Jenkins, Travis, Chef, Puppet, Salt, Va
grant and OpenStack
• Meetups arranged around the
world…with organizations like
Ebay, Cloudflare, Yandex, and
Rackspace presenting on their use of
Docker
What is Docker ?
Docker is an open-source project to easily create
lightweight, portable, self-sufficient containers
from any application that will run virtually anywhere.
LIGHTWEIGHT
Based on Linux containers
Minimal overhead (cpu/io/network)

Uses layered filesystem to save space (AUFS
- Another Union File System )
Uses a copy-on-write filesystem to track changes
PORTABLE
Can run on any Linux system that supports LXC (today).
0.7 release includes support for RedHat/Fedora family.
Raspberry pi support.
Future plans to support other container tools (lmctfy, etc.)

Possible future support for other operating systems
(Solaris, OSX, Windows?)
SELF-SUFFICIENT
A Docker container contains everything it needs to run:
• Minimal Base OS
• Libraries and frameworks
• Application code
How does Docker work?
Docker extends Linux Containers, or LXC,
with a high level API providing a lightweight virtualization solution
that runs processes in isolation
Docker consists of:
Docker server daemon which is responsible for managing all the
containers
Docker command line client which controls the server daemon.
Docker image repository is the place to find and browse docker
images. It is available at https://index.docker.io/.
How does Docker work?
Docker extends Linux Containers,
with a high level API providing a lightweight virtualization solution
that runs processes in isolation
Docker consists of:
Docker server daemon which is responsible for managing all
the containers
Docker command line client which controls the server daemon.
Docker image repository is the place to find and browse docker
images. It is available at https://index.docker.io/.
LinuX Containers(LXC)
“LXC" refers to capabilities of the Linux kernel
(specifically namespaces and control groups)
which allow sandboxing processes
from one another,
and controlling their resource allocations.
Operating system level virtualisation
Docker functionality on top of containers
Guaranteed portable deployment of applications
Application-centric
Versioning
Reuse
Sharing
Why all the excitement?
User DB

Static website

postgresql + pgv8 + v8

nginx 1.5 + modsecurity + openssl + bootstrap 2

Background workers
Python 3.0 + celery + pyredis + libcurl + ffmpeg + libopencv + nodejs +
phantomjs

Queue

Analytics DB

Redis + redis-sentinel

hadoop + hive + thrift + OpenJDK

Web frontend
Ruby + Rails + sass + Unicorn

API endpoint

Do services and apps
interact
appropriately?

Multiplicity of Stacks

The Challenge

Development VM

Production Cluster
Public Cloud

QA server
Disaster recovery

Contributor’s laptop

Customer Data Center
Production Servers

Can I migrate
smoothly and
quickly?

Multiplicity of
hardware
environments

Python 2.7 + Flask + pyredis + celery + psycopg + postgresql-client
The Matrix From Hell
Static website

?

?

?

?

?

?

?

Web frontend

?

?

?

?

?

?

?

Background workers

?

?

?

?

?

?

?

User DB

?

?

?

?

?

?

?

Analytics DB

?

?

?

?

?

?

?

Queue

?

?

?

?

?

?

?

Development
VM

QA Server

Single Prod
Server

Onsite
Cluster

Public Cloud

Contributor’s
laptop

Customer
Servers
Multiplicity of Goods

Do I worry about
how goods interact
(e.g. coffee beans
next to spices)

Can I transport quickly
and smoothly
(e.g. from boat to train
to truck)

Multipilicity of
methods for
transporting/storing

Cargo Transport Pre-1960: Another Matrix
from Hell
A standard container that is
loaded with virtually any
goods, and stays sealed until
it reaches final delivery.
…in between, can be loaded and
unloaded, stacked, transported
efficiently over long
distances, and transferred from
one mode of transport to another

Can I transport
quickly and smoothly
(e.g. from boat to
train to truck)

Multiplicity of
methods for
transporting/storing

Do I worry about
how goods interact
(e.g. coffee beans
next to spices)

Multiplicity of Goods

Solution: Intermodal Shipping Container
Static website

User DB

Web frontend

Queue

Analytics DB

An engine that enables any
payload to be encapsulated
as a
lightweight, portable, selfsufficient container…

Multiplicity of
hardware
environments

Development
VM

QA server

Customer Data
Center

Public Cloud

Production
Cluster

Contributor’s
laptop

Can I migrate
smoothly and quickly

…that can be manipulated using
standard operations and run
consistently on virtually any
hardware platform

Do services and apps
interact
appropriately?

Multiplicity of Stacks

Docker is a shipping container system for
code
Docker eliminates the matrix from Hell
Static website

Web frontend

Background workers

User DB

Analytics DB

Queue

Development
VM

QA Server

Single Prod
Server

Onsite
Cluster

Public Cloud

Contributor’s
laptop

Customer
Servers
Why it works—separation of concerns
• Dan the Developer
•

Worries about what’s “inside” the
container
•

His Apps

•

•

His Package Manager

•

His Data

All Linux servers look the same

Worries about what’s “outside”
the container
•
•
•
•

His Libraries

•

•

His code

•

• Oscar the Ops Guy

•

Logging
Remote access
Monitoring
Network config

All containers start, stop, copy,
attach, migrate, etc. the same
way
Why Developers Care
• Build once…(finally) run anywhere
• A clean and portable runtime environment for your app
• No missing dependencies etc. during subsequent deployments
• Run each app in its own isolated container
• Automate integration, packaging…anything you can script
• Eliminate concerns about compatibility on different platforms, either your own or your
customers.
• Cheap, zero-penalty containers to deploy services? A VM without the overhead of a VM?
Instant replay and reset of image snapshots? That’s the power of Docker
Why Devops Cares?
• Configure once…run anything
• Make the entire lifecycle more efficient, consistent, and repeatable
• Eliminate inconsistencies between development, test, production, and customer
environments
• Significantly improves the speed and reliability of continuous deployment and continuous
integration systems
• Because the containers are so lightweight, address significant
performance, costs, deployment, and portability issues normally associated with VMs
Containers vs. VMs
App
A

App
A’

App
B

Bins/
Libs

Bins/
Libs

Bins/
Libs

Guest
OS

Guest
OS
Guest
OS

Guest
OS
Guest
OS

VM

Containers are isolated,
but share OS and, where
appropriate, bins/libraries
…result is significantly faster
deployment, much less overhead, easier
migration, faster restart

Host OS

Host OS

Server

Server

Docker

Bins/Libs

App B’

App B’

App B’

Bins/Libs

App B

App A’

Hypervisor (Type 2)

App A

Container
Why are Docker containers lightweight?
VMs

Bins/
Libs

Bins/
Libs

Bins/
Libs

Guest
OS

Guest
OS
Guest
OS

Bins/
Libs

Original App
(No OS to take
up space, resources,
or require restart)

VMs
Every app, every copy of an
app, and every slight modification
of the app requires a new virtual server

App Δ

App
A

App
A

App
A
Bins/

App
A’

App
A

Guest
OS

Containers

Copy of
App
No OS. Can
Share bins/libs

Modified App
Copy on write
capabilities allow
us to only save the diffs
Between container A
and container
A’
What are the basics of the Docker system?
Container A

Docker
Public
Index

Push

(or
Private
Registry)

Index
Search

Run

Build
Dockerfile
For
A

Docker

Container C

Host 1 OS (Linux)

Container B

Docker Engine

Container A

Source
Code
Repository

Pull

Host 2 OS (Linux)
Changes and Updates
Push

App Δ

App
A

Bins/

Bins/
Libs

Docker
Container
Image
Registry

Container
Mod A’

Container
Mod A’’

App Δ

Base
Container
Image

Bins/
Libs

Bins/

App
A
Bins/
Libs

Bins/

App
A’’

Update

Docker Engine
Host is now running A’’

Docker Engine
Host running A wants to upgrade to A’’.
Requests update. Gets only diffs
Want to learn more:
• www.docker.io:
• Documentation
• Getting started: interactive tutorial, installation instructions, getting
started guide,
• About: Introductory whitepaper: http://www.docker.io/the-whole-story/

• Github: dotcloud/docker
• IRC: freenode/#docker
• Google groups: groups.google.com/forum/#!forum/docker-user
• Twitter: follow @docker

Docker intro

  • 1.
  • 2.
    Contents Introduction to Dockerand containers Docker v VM’s Q&A Demo
  • 3.
    Docker Timeline January 2013Docker started as internal project inside dotCloud March 2013 Docker released to public February 2014 Docker 0.8 released Production ready at 1.0
  • 4.
    In the 7months since we launched • • • • >140,000 container pulls >6,700 github stars >180 non-employee contributors >150 projects built on top of docker • UIs, mini-PaaS, Remote Desktop…. • 1000’s of Dockerized applications • Memcached, Redis, Node.js…and Hadoop • Integration in Jenkins, Travis, Chef, Puppet, Salt, Va grant and OpenStack • Meetups arranged around the world…with organizations like Ebay, Cloudflare, Yandex, and Rackspace presenting on their use of Docker
  • 5.
    What is Docker? Docker is an open-source project to easily create lightweight, portable, self-sufficient containers from any application that will run virtually anywhere.
  • 6.
    LIGHTWEIGHT Based on Linuxcontainers Minimal overhead (cpu/io/network) Uses layered filesystem to save space (AUFS - Another Union File System ) Uses a copy-on-write filesystem to track changes
  • 7.
    PORTABLE Can run onany Linux system that supports LXC (today). 0.7 release includes support for RedHat/Fedora family. Raspberry pi support. Future plans to support other container tools (lmctfy, etc.) Possible future support for other operating systems (Solaris, OSX, Windows?)
  • 8.
    SELF-SUFFICIENT A Docker containercontains everything it needs to run: • Minimal Base OS • Libraries and frameworks • Application code
  • 9.
    How does Dockerwork? Docker extends Linux Containers, or LXC, with a high level API providing a lightweight virtualization solution that runs processes in isolation Docker consists of: Docker server daemon which is responsible for managing all the containers Docker command line client which controls the server daemon. Docker image repository is the place to find and browse docker images. It is available at https://index.docker.io/.
  • 10.
    How does Dockerwork? Docker extends Linux Containers, with a high level API providing a lightweight virtualization solution that runs processes in isolation Docker consists of: Docker server daemon which is responsible for managing all the containers Docker command line client which controls the server daemon. Docker image repository is the place to find and browse docker images. It is available at https://index.docker.io/.
  • 11.
    LinuX Containers(LXC) “LXC" refersto capabilities of the Linux kernel (specifically namespaces and control groups) which allow sandboxing processes from one another, and controlling their resource allocations. Operating system level virtualisation
  • 12.
    Docker functionality ontop of containers Guaranteed portable deployment of applications Application-centric Versioning Reuse Sharing
  • 13.
    Why all theexcitement?
  • 14.
    User DB Static website postgresql+ pgv8 + v8 nginx 1.5 + modsecurity + openssl + bootstrap 2 Background workers Python 3.0 + celery + pyredis + libcurl + ffmpeg + libopencv + nodejs + phantomjs Queue Analytics DB Redis + redis-sentinel hadoop + hive + thrift + OpenJDK Web frontend Ruby + Rails + sass + Unicorn API endpoint Do services and apps interact appropriately? Multiplicity of Stacks The Challenge Development VM Production Cluster Public Cloud QA server Disaster recovery Contributor’s laptop Customer Data Center Production Servers Can I migrate smoothly and quickly? Multiplicity of hardware environments Python 2.7 + Flask + pyredis + celery + psycopg + postgresql-client
  • 15.
    The Matrix FromHell Static website ? ? ? ? ? ? ? Web frontend ? ? ? ? ? ? ? Background workers ? ? ? ? ? ? ? User DB ? ? ? ? ? ? ? Analytics DB ? ? ? ? ? ? ? Queue ? ? ? ? ? ? ? Development VM QA Server Single Prod Server Onsite Cluster Public Cloud Contributor’s laptop Customer Servers
  • 16.
    Multiplicity of Goods DoI worry about how goods interact (e.g. coffee beans next to spices) Can I transport quickly and smoothly (e.g. from boat to train to truck) Multipilicity of methods for transporting/storing Cargo Transport Pre-1960: Another Matrix from Hell
  • 17.
    A standard containerthat is loaded with virtually any goods, and stays sealed until it reaches final delivery. …in between, can be loaded and unloaded, stacked, transported efficiently over long distances, and transferred from one mode of transport to another Can I transport quickly and smoothly (e.g. from boat to train to truck) Multiplicity of methods for transporting/storing Do I worry about how goods interact (e.g. coffee beans next to spices) Multiplicity of Goods Solution: Intermodal Shipping Container
  • 18.
    Static website User DB Webfrontend Queue Analytics DB An engine that enables any payload to be encapsulated as a lightweight, portable, selfsufficient container… Multiplicity of hardware environments Development VM QA server Customer Data Center Public Cloud Production Cluster Contributor’s laptop Can I migrate smoothly and quickly …that can be manipulated using standard operations and run consistently on virtually any hardware platform Do services and apps interact appropriately? Multiplicity of Stacks Docker is a shipping container system for code
  • 19.
    Docker eliminates thematrix from Hell Static website Web frontend Background workers User DB Analytics DB Queue Development VM QA Server Single Prod Server Onsite Cluster Public Cloud Contributor’s laptop Customer Servers
  • 20.
    Why it works—separationof concerns • Dan the Developer • Worries about what’s “inside” the container • His Apps • • His Package Manager • His Data All Linux servers look the same Worries about what’s “outside” the container • • • • His Libraries • • His code • • Oscar the Ops Guy • Logging Remote access Monitoring Network config All containers start, stop, copy, attach, migrate, etc. the same way
  • 21.
    Why Developers Care •Build once…(finally) run anywhere • A clean and portable runtime environment for your app • No missing dependencies etc. during subsequent deployments • Run each app in its own isolated container • Automate integration, packaging…anything you can script • Eliminate concerns about compatibility on different platforms, either your own or your customers. • Cheap, zero-penalty containers to deploy services? A VM without the overhead of a VM? Instant replay and reset of image snapshots? That’s the power of Docker
  • 22.
    Why Devops Cares? •Configure once…run anything • Make the entire lifecycle more efficient, consistent, and repeatable • Eliminate inconsistencies between development, test, production, and customer environments • Significantly improves the speed and reliability of continuous deployment and continuous integration systems • Because the containers are so lightweight, address significant performance, costs, deployment, and portability issues normally associated with VMs
  • 23.
    Containers vs. VMs App A App A’ App B Bins/ Libs Bins/ Libs Bins/ Libs Guest OS Guest OS Guest OS Guest OS Guest OS VM Containersare isolated, but share OS and, where appropriate, bins/libraries …result is significantly faster deployment, much less overhead, easier migration, faster restart Host OS Host OS Server Server Docker Bins/Libs App B’ App B’ App B’ Bins/Libs App B App A’ Hypervisor (Type 2) App A Container
  • 24.
    Why are Dockercontainers lightweight? VMs Bins/ Libs Bins/ Libs Bins/ Libs Guest OS Guest OS Guest OS Bins/ Libs Original App (No OS to take up space, resources, or require restart) VMs Every app, every copy of an app, and every slight modification of the app requires a new virtual server App Δ App A App A App A Bins/ App A’ App A Guest OS Containers Copy of App No OS. Can Share bins/libs Modified App Copy on write capabilities allow us to only save the diffs Between container A and container A’
  • 25.
    What are thebasics of the Docker system? Container A Docker Public Index Push (or Private Registry) Index Search Run Build Dockerfile For A Docker Container C Host 1 OS (Linux) Container B Docker Engine Container A Source Code Repository Pull Host 2 OS (Linux)
  • 26.
    Changes and Updates Push AppΔ App A Bins/ Bins/ Libs Docker Container Image Registry Container Mod A’ Container Mod A’’ App Δ Base Container Image Bins/ Libs Bins/ App A Bins/ Libs Bins/ App A’’ Update Docker Engine Host is now running A’’ Docker Engine Host running A wants to upgrade to A’’. Requests update. Gets only diffs
  • 27.
    Want to learnmore: • www.docker.io: • Documentation • Getting started: interactive tutorial, installation instructions, getting started guide, • About: Introductory whitepaper: http://www.docker.io/the-whole-story/ • Github: dotcloud/docker • IRC: freenode/#docker • Google groups: groups.google.com/forum/#!forum/docker-user • Twitter: follow @docker