SlideShare a Scribd company logo
Reality, Not Hype
Docker in Production
@bridgetkromhout
Bridget Kromhout
@bridgetkromhout
bridgetkromhout.com
Operations Engineer
@arresteddevops
@devopsdays
@bridgetkromhout
DramaFever.
com
Streaming international
content starting in 2009
Docker in production since
October 2013
@bridgetkromhout
docclub.com since Fall 2014
@bridgetkromhout
shudder.com launched Summer 2015
@bridgetkromhout
15K 70 15 20M
Peak load: tens of thousands of requests per second
Traffic variance: swings 10-20x throughout the week
@bridgetkromhout
autoscaling in AWS
streaming delivery via Akamai
@bridgetkromhout
Architecture
Python/Django
Upstreams routed via nginx
Go microservices
state in RDS, DynamoDB,
Elasticache
API endpoints for native clients
Celery/SQS for async tasks
@bridgetkromhout
consistent development repeatable deployment
Why Docker?
@bridgetkromhout
one year ago...
Vagrant for local development
chef-solo provisioner
17 minutes to install everything
@bridgetkromhout
images built on jenkins
mysql image built with fixtures
can run master or qa image (or
even prod)
can build new local images
from Dockerfiles
a year of boot2docker
@bridgetkromhout
docker in production: in theory
@bridgetkromhout
docker in production: in practice
@bridgetkromhout
Distributed private S3-backed
Docker registry:
registry container on each ec2
instance
more effective scaling
Post by Tim Gross: http://0x74696d.com/posts/host-
local-docker-registry/
@bridgetkromhout
docker options
# goes in /etc/default/docker to control docker's
upstart
DOCKER_OPTS="--graph=/mnt/docker --insecure-
registry=localhost-alias.com:5000"
localhost-alias.com in DNS with A record to 127.0.0.1
OS X /etc/hosts: use the boot2docker host-only
network IP
@bridgetkromhout
registry upstart
docker pull public_registry_image
docker run -p 5000:5000 --name registry 
-v /etc/docker-reg:/registry-conf 
-e DOCKER_REGISTRY_CONFIG=/registry-conf/config.yml 
public_registry_image
@bridgetkromhout
config.yml
s3_region: us-east-1
s3_access_key: <aws-accesskey>
s3_secret_key: <aws-secretkey>
s3_bucket: <bucketname>
standalone: true
storage: s3
storage_path: /registry
@bridgetkromhout
docker run 
-d 
-p 5000:5000 
--name docker-reg 
-v ${DFHOME}:${DFHOME} 
-e DOCKER_REGISTRY_CONFIG=${DFHOME}/config/registry/config.yml 
public_registry_image
private registry for
dev
@bridgetkromhout
S3 requires clock sync
$ docker pull local-repo-alias.com:5000/mysql
Pulling repository local-repo-alias.com:5000/mysql
2014/11/24 19:44:31 HTTP code: 500
$ boot2docker ssh sudo date --set "$(env TZ=UTC date
'+%F %H:%M:%S')"
@bridgetkromhout
Jenkins-driven image builds
@bridgetkromhout
weekly base builds
FROM local-repo-alias.com:5000/www-base
● include infrequently-changing
dependencies
○ ubuntu packages
○ pip requirements
○ wheels
● other builds can start from these images
(so they’re faster):
@bridgetkromhout
www-master build
sudo docker build -t="a12fbdc" .
sudo docker run -i -t -w /var/www -e DJANGO_TEST=1 --name
test.a12fbdc a12fbdc py.test -s
sudo docker tag a12fbdc local-repo-alias.com:5000/www:'dev'
sudo docker push local-repo-alias.com:5000/www:'dev'
@bridgetkromhout
container-building containers
easier with statically
linked binaries
Go microservices
Android APK
@bridgetkromhout
$ docker images
REPOSITORY TAG IMAGE ID CREATED VIRTUAL
SIZE
local-repo-alias.com:5000/mysql dev b0dc5885f767 2 days ago 905.9 MB
local-repo-alias.com:5000/www dev 82cda604a4f1 2 days ago 1.092 GB
local-repo-alias.com:5000/micro local bed20dc84ea1 4 days ago 10.08 MB
google/golang 1.3 e3934c44b8e4 2 weeks ago 514.3 MB
public_registry_image 0.6.9 11299d377a9e 6 months ago 454.5 MB
scratch latest 511136ea3c5a 18 months ago 0 B
$
ever-smaller images
@bridgetkromhout
a cautionary word on storage drivers
@bridgetkromhout
2014/10/30 21:35:31 Error getting container init rootfs
b528d54a0458a8cd8a798309930adb45cb5e1a7430e98
1e0f3108f86386aab67 from driver devicemapper: open
/dev/mapper/docker-9:127-14024705-
b528d54a0458a8cd8a798309930adb45cb5e1a7430e98
1e0f3108f86386aab67-init: no such file or directory
make: *** [build-django] Error 1
Build step 'Execute shell' marked build as failure
breaking builds
@bridgetkromhout
@bridgetkromhout
useful for unattended
base builds, but...
...seeing this in Slack got old
@bridgetkromhout
DOCKER_OPTS="--graph=/mnt/docker
--insecure-registry=local-repo-
alias.com:5000 --storage-
driver=aufs"
replace storage driver for jenkins instance
@bridgetkromhout
bash 'install kernel extras for
aufs' do
code <<-EOH
apt-get -y install linux-image-
extra-$(uname -r)
EOH
end
ubuntu 14.04: aufs in kernel extras
@bridgetkromhout
(yes, modulo what’s available for your kernel)
@bridgetkromhout
for persistent instances
# remove stopped containers
@daily docker rm `docker ps -aq`
# remove images tagged "none"
@daily docker rmi `sudo docker images | grep
none | awk -F' +' '{print $3}'`
@bridgetkromhout
deploys
using fabric
tag for staging
tag for prod
out of ELB
restart upstart
back in ELB
@bridgetkromhout
@bridgetkromhout
Autoscaling
Packer
AMI
EC2 Instances
Jenkins
GitHub
Chef
AMI factory
@bridgetkromhout
#!/bin/bash
cat <<EOF > /etc/init/django.conf
description "Run Django containers for www"
start on started docker-reg
stop on runlevel [!2345] or stopped docker
respawn limit 5 30
[...]
replacing 100s of lines of userdata...
@bridgetkromhout
...with a chef-client run & packer build.
#!/bin/bash
# upstart configs are now created by chef
rm /etc/chef/client.pem
mkdir -p /var/log/chef
chef-client -r 'role[rolename]' -E
'environment' -L /var/log/chef/chef-client.
log
@bridgetkromhout
upstart config
docker run 
-e DJANGO_ENVIRON=PROD 
-e HAPROXY=df/haproxy-prod.cfg 
-p 8000:8000 
-v /var/log/containers:/var/log 
--name django 
localhost-alias.com:5000/www:prod 
/var/www/bin/start-django
@bridgetkromhout
docker run 
<% if @docker_rm == true -%>
--rm 
<% end %>
<% @docker_env.each do |k, v| -%>
-e <%= k %>=<%= v %> 
<% end %>
<% @docker_port.each do |p| -%>
-p <%= p %> 
<% end %>
upstart template
@bridgetkromhout
<% @docker_volume.each do |v| -%>
-v <%= v %> 
<% end %>
--name <%= @application_name %> 
localhost-alias.com:<%= @registry_port %>/<%=
@docker_image %>:<%= @docker_tag %> 
<%= @docker_command %>
upstart template
(cont)
@bridgetkromhout
using attributes
attribute :command, :kind_of => String, :required => true
attribute :env, :kind_of => Hash, :default => {}
attribute :port, :kind_of => Array, :default => []
attribute :volume, :kind_of => Array, :default =>
['/var/log/containers:/var/log']
attribute :rm, :kind_of => [TrueClass, FalseClass], :default => false
attribute :image, :kind_of => String, :required => true
attribute :tag, :kind_of => String, :required => true
attribute :type, :kind_of => String, :required => true
attribute :cron, :kind_of => [TrueClass, FalseClass], :default => false
@bridgetkromhout
recipe using LWRP
base_docker node['www']['django']['name'] do
command node['www']['django']['command']
env node['www'][service]['django'][env]['env']
image node['www']['django']['image']
port node['www'][service]['django'][env]['port']
tag node['www'][service]['django'][env]['tag']
type node['www']['django']['type']
end
@bridgetkromhout
packer for ami building
{
"type": "chef-client",
"server_url": "https://api.opscode.com/organizations/dramafever",
"run_list": [ "base::ami" ],
"validation_key_path": "{{user `chef_validation`}}",
"validation_client_name": "dramafever-validator",
"node_name": "packer-ami"
}
@bridgetkromhout
packer run
$HOME/packer/packer build 
-var "account_id=$AWS_ACCOUNT_ID" 
-var "aws_access_key_id=$AWS_ACCESS_KEY_ID" 
-var "aws_secret_key=$AWS_SECRET_ACCESS_KEY" 
-var "x509_cert_path=$AWS_X509_CERT_PATH" 
-var "x509_key_path=$AWS_X509_KEY_PATH" 
-var "s3_bucket=bucketname" 
-var "ami_name=$AMI_NAME" 
-var "source_ami=$SOURCE_AMI" 
-var "chef_validation=$CHEF_VAL" 
-var "chef_client=$HOME/packer/client.rb" 
-only=amazon-instance 
$HOME/packer/prod.json
@bridgetkromhout
limiting packer IAM permissions
"Action":[
"ec2:TerminateInstances",
"ec2:StopInstances",
"ec2:DeleteSnapshot",
"ec2:DetachVolume",
"ec2:DeleteVolume",
"ec2:ModifyImageAttribute"
],
"Effect":"Allow",
"Resource":"*",
"Condition":{
"StringEquals":{ "ec2:
ResourceTag/name":"Packer Builder"
}
}
@bridgetkromhout
and now you have a new problem...
@bridgetkromhout
container clustering
evaluating Mesos/Marathon
+/- autoscaling
+/- discovery
@bridgetkromhout
obligatory container disaster
protip: does not represent reality
tl;dr: containers aren’t going to
solve all your problems…
...but they aren’t actually all that
hard to use, either.
@bridgetkromhout
security
(we focus on host-level security, not isolation…
...and we don’t run arbitrary images from the internets.)
@bridgetkromhout
logs
-v /var/log/containers:/var/log
<Input containers_in>
Module im_file
Recursive False
File '/var/log/containers/*.log'
Exec $FileName = file_name();
Exec $raw_event = $FileName + ' ' + $raw_event ;
Exec $Message = $raw_event ;
</Input>
@bridgetkromhout
monitoring & alerting
@bridgetkromhout
Docker in production:
honestly, it’s pretty awesome.
@bridgetkromhout
Thank you!
(and we’re hiring!)
dramafever.com/company/careers.html

More Related Content

PDF
From development environments to production deployments with Docker, Compose,...
PPTX
Learn docker in 90 minutes
PPTX
Architecting .NET Applications for Docker and Container Based Deployments
PDF
Docker by Example - Basics
PPTX
Docker - Demo on PHP Application deployment
PDF
Docker in development (Story)
PDF
Docker, the Future of DevOps
PDF
Introduction To Docker
From development environments to production deployments with Docker, Compose,...
Learn docker in 90 minutes
Architecting .NET Applications for Docker and Container Based Deployments
Docker by Example - Basics
Docker - Demo on PHP Application deployment
Docker in development (Story)
Docker, the Future of DevOps
Introduction To Docker

What's hot (20)

PDF
Docker - From Walking To Running
PDF
A Hands-on Introduction to Docker
PDF
Basic docker for developer
PPT
Amazon Web Services and Docker
PDF
Shipping Applications to Production in Containers with Docker
ODP
Docker - The Linux Container
PPTX
Docker-Hanoi @DKT , Presentation about Docker Ecosystem
PDF
Docker Continuous Delivery Workshop
PDF
Optimizing Docker Images
PDF
Solving Real World Production Problems with Docker
PDF
Using Docker in the Real World
PDF
Deployment Automation with Docker
PDF
Docker at Djangocon 2013 | Talk by Ken Cochrane
PDF
Docker 101 @KACST Saudi HPC 2016
PDF
Real-World Docker: 10 Things We've Learned
PDF
Docker Presentation at the OpenStack Austin Meetup | 2013-09-12
PDF
Locally it worked! virtualizing docker
PDF
Docker + Microservices in Production
PDF
Docker Introduction
PDF
Vagrant + Docker provider [+Puppet]
Docker - From Walking To Running
A Hands-on Introduction to Docker
Basic docker for developer
Amazon Web Services and Docker
Shipping Applications to Production in Containers with Docker
Docker - The Linux Container
Docker-Hanoi @DKT , Presentation about Docker Ecosystem
Docker Continuous Delivery Workshop
Optimizing Docker Images
Solving Real World Production Problems with Docker
Using Docker in the Real World
Deployment Automation with Docker
Docker at Djangocon 2013 | Talk by Ken Cochrane
Docker 101 @KACST Saudi HPC 2016
Real-World Docker: 10 Things We've Learned
Docker Presentation at the OpenStack Austin Meetup | 2013-09-12
Locally it worked! virtualizing docker
Docker + Microservices in Production
Docker Introduction
Vagrant + Docker provider [+Puppet]
Ad

Similar to Docker in production: reality, not hype (OSCON 2015) (20)

PDF
Scaling Next-Generation Internet TV on AWS With Docker, Packer, and Chef
PDF
Lights, Camera, Docker: Streaming Video at DramaFever
PDF
Docker in Production: Reality, Not Hype - DevOps Chicago
PDF
Docker in Production: Reality, Not Hype
PDF
Cooking Up Drama
PDF
Cooking Up Drama - ChefConf 2015
PDF
[convergese] Adaptive Images in Responsive Web Design
PDF
Deploying configurable frontend web application containers
PDF
[refreshaustin] Adaptive Images in Responsive Web Design
PDF
[HEWEBAR 2012] Adaptive Images in Responsive Web Design
PDF
Into The Box 2018 Going live with commandbox and docker
PDF
Going live with BommandBox and docker Into The Box 2018
PDF
Analyzing the Performance of Mobile Web
PPTX
Running Docker in Development & Production (#ndcoslo 2015)
PDF
'DOCKER' & CLOUD: ENABLERS For DEVOPS
PDF
Docker and Cloud - Enables for DevOps - by ACA-IT
PDF
Http/2 - What's it all about?
PDF
Docker Demo @ IuK Seminar
PDF
Docker as an every day work tool
PDF
Dev with Docker WCPHX 2019
Scaling Next-Generation Internet TV on AWS With Docker, Packer, and Chef
Lights, Camera, Docker: Streaming Video at DramaFever
Docker in Production: Reality, Not Hype - DevOps Chicago
Docker in Production: Reality, Not Hype
Cooking Up Drama
Cooking Up Drama - ChefConf 2015
[convergese] Adaptive Images in Responsive Web Design
Deploying configurable frontend web application containers
[refreshaustin] Adaptive Images in Responsive Web Design
[HEWEBAR 2012] Adaptive Images in Responsive Web Design
Into The Box 2018 Going live with commandbox and docker
Going live with BommandBox and docker Into The Box 2018
Analyzing the Performance of Mobile Web
Running Docker in Development & Production (#ndcoslo 2015)
'DOCKER' & CLOUD: ENABLERS For DEVOPS
Docker and Cloud - Enables for DevOps - by ACA-IT
Http/2 - What's it all about?
Docker Demo @ IuK Seminar
Docker as an every day work tool
Dev with Docker WCPHX 2019
Ad

More from bridgetkromhout (20)

PDF
An introduction to Helm - KubeCon EU 2020
PDF
Join Our Party: The Cloud Native Adventure Brigade (Kubernetes Belgium 2019)
PDF
devops, distributed (devopsdays Ghent 2019)
PDF
Join Our Party: The Cloud Native Adventure Brigade (devopsdays Philly 2019)
PDF
Join Our Party: The Cloud Native Adventure Brigade (TCSW 2019)
PDF
Increasing Reliability via Helm Pre-Release Checks (Helm Summit 2019)
PDF
Kubernetes for the Impatient (devopsdays Cape Town 2019)
PDF
Join Our Party: The Cloud Native Adventure Brigade (OSS 2019)
PDF
Helm 3: Navigating To Distant Shores (OSS NA 2019)
PDF
Helm 3: Navigating to Distant Shores (OSCON 2019)
PDF
Kubernetes for the Impatient (Velocity San Jose 2019)
PDF
Community projects inform enterprise products (Velocity San Jose 2019)
PDF
Helm 3: Navigating to Distant Shores (KubeCon EU 2019)
PDF
Kubernetes Operability Tooling (GOTO Chicago 2019)
PDF
Kubernetes Operability Tooling (Minnebar 2019)
PDF
Livetweeting Tech Conferences - SREcon Americas 2019
PDF
Kubernetes Operability Tooling (devopsdays Seattle 2019)
PDF
Kubernetes Operability Tooling (LEAP 2019)
PDF
Day 2 Kubernetes - Tools for Operability (KubeCon)
PDF
Cloud, Containers, Kubernetes (YOW Melbourne 2018)
An introduction to Helm - KubeCon EU 2020
Join Our Party: The Cloud Native Adventure Brigade (Kubernetes Belgium 2019)
devops, distributed (devopsdays Ghent 2019)
Join Our Party: The Cloud Native Adventure Brigade (devopsdays Philly 2019)
Join Our Party: The Cloud Native Adventure Brigade (TCSW 2019)
Increasing Reliability via Helm Pre-Release Checks (Helm Summit 2019)
Kubernetes for the Impatient (devopsdays Cape Town 2019)
Join Our Party: The Cloud Native Adventure Brigade (OSS 2019)
Helm 3: Navigating To Distant Shores (OSS NA 2019)
Helm 3: Navigating to Distant Shores (OSCON 2019)
Kubernetes for the Impatient (Velocity San Jose 2019)
Community projects inform enterprise products (Velocity San Jose 2019)
Helm 3: Navigating to Distant Shores (KubeCon EU 2019)
Kubernetes Operability Tooling (GOTO Chicago 2019)
Kubernetes Operability Tooling (Minnebar 2019)
Livetweeting Tech Conferences - SREcon Americas 2019
Kubernetes Operability Tooling (devopsdays Seattle 2019)
Kubernetes Operability Tooling (LEAP 2019)
Day 2 Kubernetes - Tools for Operability (KubeCon)
Cloud, Containers, Kubernetes (YOW Melbourne 2018)

Recently uploaded (20)

PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
cuic standard and advanced reporting.pdf
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PPTX
Big Data Technologies - Introduction.pptx
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
NewMind AI Monthly Chronicles - July 2025
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Encapsulation theory and applications.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Unlocking AI with Model Context Protocol (MCP)
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
CIFDAQ's Market Insight: SEC Turns Pro Crypto
cuic standard and advanced reporting.pdf
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Understanding_Digital_Forensics_Presentation.pptx
Big Data Technologies - Introduction.pptx
Reach Out and Touch Someone: Haptics and Empathic Computing
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
NewMind AI Monthly Chronicles - July 2025
20250228 LYD VKU AI Blended-Learning.pptx
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Diabetes mellitus diagnosis method based random forest with bat algorithm
Encapsulation theory and applications.pdf
The AUB Centre for AI in Media Proposal.docx
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Unlocking AI with Model Context Protocol (MCP)

Docker in production: reality, not hype (OSCON 2015)