3. What is a Docker?
Build, Ship and Run Any App, Anywhere
Lightweight Virtualized Environments
4. Static website
Web frontend
User DB
Queue Analytics DB
Background workers
API endpoint
nginx 1.5 + modsecurity + openssl + bootstrap 2
postgresql + pgv8 + v8
hadoop + hive + thrift + OpenJDK
Ruby + Rails + sass + Unicorn
Redis + redis-sentinel
Python 3.0 + celery + pyredis + libcurl + ffmpeg + libopencv + nodejs +
phantomjs
Python 2.7 + Flask + pyredis + celery + psycopg + postgresql-client
Development VM
QA server
Public Cloud
Disaster recovery
Contributor’s laptop
Production Servers
The Challenge
Multiplicityof
Stacks
Multiplicityof
hardware
environments
Production Cluster
Customer Data Center
Doservicesand
appsinteract
appropriately?
CanImigrate
smoothlyand
quickly?
Slide Reference: DockerCon
5. Static website Web frontendUser DB Queue Analytics DB
Development
VM
QA server Public Cloud Contributor’s
laptop
Docker containers to rescue
MultiplicityofStacks
Multiplicityof
hardware
environments
Production
Cluster
Customer Data
Center
Doservicesand
appsinteract
appropriately?
CanImigrate
smoothlyand
quickly
…that can be manipulated using
standard operations and run
consistently on virtually any
hardware platform
An engine that enables any
payload to be encapsulated
as a lightweight, portable,
self-sufficient container…
Slide Reference: DockerCon
6. VMs vs Bare Containers vs Docker
Hardware
Operating System
Type 2 Hypervisor
Virtual Machine
Operating
System
Bins / libs
App App
Virtual Machine
Operating
System
Bins / libs
App App
Hardware
Type 1 Hypervisor
Virtual Machine
Operating
System
Bins / libs
App App
Virtual Machine
Operating
System
Bins / libs
App App
Hardware
Operating System
Container
Bins / libs
App App
Container
Bins / libs
App App
7. VMs vs Bare Containers vs Docker
Hardware
Operating System
Type 2 Hypervisor
Virtual Machine
Operating
System
Bins / libs
App App
Virtual Machine
Operating
System
Bins / libs
App App
Hardware
Type 1 Hypervisor
Virtual Machine
Operating
System
Bins / libs
App App
Virtual Machine
Operating
System
Bins / libs
App App
Hardware
Operating System
Container
Bins / libs
App App
Container
Bins / libs
App App
9. Docker Architecture
• Client Server Architecture
– Sockets or RESTfull API
• Docker Deamon
• Docker client
• Images – a read-only
templates
• Registries - holds images
• Container – created from an
image
10. sudo docker run -i -t ubuntu /bin/bash
• Pulls the ubuntu image
• Creates a new container
• Allocates a filesystem and mounts a read-write layer
• Allocates a network / bridge interface
• Sets up an IP address
• Executes a process that you specify
• Captures and provides application output
13. Setup
• On your servers (LINUX)
– Packages (Ubuntu, Debian, Fedora etc.)
– Single Binary install
– Easy provisioning on Rackspace, Digital Ocean, AWS – EC2, GCE,
Windows Azure
• On your dev environment
– Vagrant Up
– Boot2docker (25 MB VM image)
– Natively (If you run Linux)
Linux Kernel 3.8
14. Technologies
• Go Lang
• Open Sourced by DotCloud March
2013
• Libcontainer - cgroups, namespaces
– LXC as default environments in
versions < 0.9
15. Authoring Images with Dockerfile# DOCKER-VERSION 0.10.0
# Pull base image.
FROM ubuntu:14.04
# Install Node.js
RUN apt-get update
RUN apt-get install -y software-properties-common
RUN add-apt-repository -y ppa:chris-lea/node.js
RUN apt-get update
RUN apt-get install -y nodejs
RUN apt-get install -y supervisor
RUN mkdir -p /var/log/supervisor
ADD . /src
# add the supervisor config file to default location that it would look for
ADD supervisord.conf /etc/supervisor/conf.d/supervisord.conf
RUN cd /src; npm install
ENV PORT 3001
ENV NODE_ENV development
EXPOSE 3001
CMD ["node", "/src/server.js"]
17. One Process per Container
Only one process per container
Use supervisor process to launch multiple child process inside
the container
18. Docker Hub
• SaaS offerings - Public and private repositories
• Need your own private registry?
– https://github.com/docker/docker-registry
– Also a Docker container
21. Ecosystem
• Cocaine, Dein, Flynn – Private PaaS
• CoreOS, full distro based on Docker – Linux Distribution
• Red Hat’s Project Atomic - Linux Distribution
• Google’s Kubernetes – container management
• New Relic Centurian – container management
• OpenStack Integration (In Havana, Nova has Docker driver)
• Vagrant – Docker provider
22. Related Open Source Libraries
Go lang based
•libcontainer
•libchan
•libswarm
23. Use Cases
• Cloud9 IDE
• eBay
• mailGun/Rackspace
• CloudFlare
• Cambridge Health Care
• Red Hat Openshift