SlideShare ist ein Scribd-Unternehmen logo
1 von 39
Downloaden Sie, um offline zu lesen
@bridgetkromhout
Docker in Production
Reality, Not Hype
Bridget Kromhout
@bridgetkromhout
Bridget Kromhout
Operations Engineer
@DramaFever
Minneapolis, Minnesota
@devopsdays
@devopsdaysMSP
@arresteddevops
bridgetkromhout.com
@bridgetkromhout
K-dramas since 2009. Docker in prod since October 2013.
@bridgetkromhout
architecture
● All services in AWS
● Python (Django) main website
● Go microservices (video analytics ingest, on-the
fly image processing, bookmarking…)
● Upstreams routed via nginx
● Celery + SQS for async tasks
@bridgetkromhout
scale
● Streaming delivery through Akamai
● peak load at 10s of thousands of
requests per second to the website
● The sine wave has a 10-20x differential
throughout the week
@bridgetkromhout
Why Docker?
consistent development repeatable deployment
How?
not:
a tutorial
but:
repeatable
@bridgetkromhout
private registry:
the official party line
https://github.com/docker/docker-
registry#quick-start
S3 is a storage engine option
but… a central registry server didn’t scale well
for us
@bridgetkromhout
private registry: dramafever
@bridgetkromhout
# this goes in /etc/default/docker to control
docker's upstart config
DOCKER_OPTS="--graph=/mnt/docker --insecure-
registry=local-repo-alias.com:5000"
● local-repo-alias.com in DNS with A record to 127.0.0.1
● OS X /etc/hosts: use the boot2docker host-only network IP
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
@bridgetkromhout
what even is flate?!
Pulling repository local-repo-alias.com:5000/www
4dda2b433370: Error pulling image (prod) from
local-repo-alias.com:5000/www, flate: corrupt
input before offset 54393671 flate: corrupt
input before offset 54393671
d497ad3926c8: Error downloading dependent layers
2014/12/07 02:34:54 Error pulling image (prod)
from local-repo-alias.com:5000/www, flate:
corrupt input before offset 54393671
@bridgetkromhout
registry rewrite coming!
DOCKER_OPTS="--graph=/mnt/docker --
insecure-registry=local-repo-alias.
com:5000 -e STORAGE_REDIRECT=true"
...until we get to the promised go lan(d|g), there’s a
workaround for the flate errors we’re seeing:
@bridgetkromhout
Achievement
unlocked:
distributed
private
Docker
registry
@bridgetkromhout
@bridgetkromhout
Next up:
build pipeline
starring
everyone’s
favorite butler
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
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
www-master build
2014/10/30 21:35:31 Error getting container init rootfs
b528d54a0458a8cd8a798309930adb45cb5e1a7430e981e0f
3108f86386aab67 from driver devicemapper: open
/dev/mapper/docker-9:127-14024705-
b528d54a0458a8cd8a798309930adb45cb5e1a7430e981e0f
3108f86386aab67-init: no such file or directory
make: *** [build-django] Error 1
Build step 'Execute shell' marked build as failure
@bridgetkromhout
breaking builds
https://wiki.jenkins-ci.org/display/JENKINS/Naginator+Plugin
@bridgetkromhout
@bridgetkromhout
Retry the build…
...only if a specific regex appears
@bridgetkromhout
useful for unattended
base builds
need to change how it
reports to Slack
@bridgetkromhout
tag for staging
tag for prod
out of ELB
restart upstart
back in ELB
Ship it!
What
about
local
development?
@bridgetkromhout
before summer 2014
Vagrant for local development
chef-solo provisioner
17 minutes to install everything
@bridgetkromhout
now: boot2docker
devs pull down images built on jenkins
mysql image is built with fixtures
can run master or qa image (or even prod)
can build new local images from Dockerfiles
@bridgetkromhout
local registry for dev
docker run -d -p 5000:5000 --name
docker-reg -v ${DFHOME}:${DFHOME} -e
DOCKER_REGISTRY_CONFIG=${DFHOME}
/config/docker-registry/config.yml
public_registry_image
@bridgetkromhout
$ boot2docker ssh date -u
Mon Nov 24 16:09:02 UTC 2014
$ date -u
Tue Nov 25 01:43:49 UTC 2014
@bridgetkromhout
time is what turns kittens into cats
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
Devs can use their preferred editing environment:
-v ${DFHOME}/www:/var/www
We still want logs, too, so we expose those for the dev here:
-v ${DFHOME}/www/run:/var/log
volume mounting & our fork
@bridgetkromhout
Until 1.3 we ran a forked boot2docker
We needed to mount local files into the VM
containerizing front-end
useful for building front-end apps on Jenkins
also allows consistent testing
RUN apt-get install -y nodejs nodejs-legacy npm
RUN npm install -g grunt-cli@0.1.13
RUN npm install -g bower@1.3.8
RUN npm install -g phantomjs@1.9.7-14
ADD bower.json /var/www/dependencies/bower.json
RUN cd /var/www/dependencies && bower install --
allow-root
--config.interactive=false --force
@bridgetkromhout
@bridgetkromhout
django:
image: local-repo-alias.com:5000/www:dev
ports:
- "8000:8000"
links:
- mysql
- redis
environment:
- PYTHONPATH=/var/local
- DJANGO_ENVIRON=LOCAL
- DB_PORT_3306_TCP_ADDR=mysql
command: /var/local/config/local/start-django-local
volumes:
- ${DFHOME}/www/run:/var/log
- ${DFHOME}/www:/var/local
mysql:
image: local-repo-alias.com:5000/mysql:dev
expose:
- "3306:3306"
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
failure modes
cron zombies
out of memory errors
race conditions
@bridgetkromhout
what isolation?
-v /var/log/containers:/var/log
@bridgetkromhout
Host instances moving into
ami factory
@bridgetkromhout
through a container darkly: monitoring
@bridgetkromhout
containers building
(lighter) 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
@bridgetkromhout
Thank you!

Weitere ähnliche Inhalte

Was ist angesagt?

Docker at Monoco.jp (LinkedIn)
Docker at Monoco.jp (LinkedIn)Docker at Monoco.jp (LinkedIn)
Docker at Monoco.jp (LinkedIn)
Akhmad Fathonih
 

Was ist angesagt? (19)

Devfest 2021' - Artifact Registry Introduction (Taipei)
Devfest 2021' - Artifact Registry Introduction (Taipei)Devfest 2021' - Artifact Registry Introduction (Taipei)
Devfest 2021' - Artifact Registry Introduction (Taipei)
 
TDC2018SP | Trilha Containers - CI/CD com Docker e Drone
TDC2018SP | Trilha Containers - CI/CD com Docker e DroneTDC2018SP | Trilha Containers - CI/CD com Docker e Drone
TDC2018SP | Trilha Containers - CI/CD com Docker e Drone
 
Google App Engine: Basic
Google App Engine: BasicGoogle App Engine: Basic
Google App Engine: Basic
 
Introduction to Express and Grunt
Introduction to Express and GruntIntroduction to Express and Grunt
Introduction to Express and Grunt
 
Workshop - Golang language
Workshop - Golang languageWorkshop - Golang language
Workshop - Golang language
 
Docker and fig for dev
Docker and fig for devDocker and fig for dev
Docker and fig for dev
 
Coscup x ruby conf tw 2021 google cloud buildpacks 剖析與實踐
Coscup x ruby conf tw 2021  google cloud buildpacks 剖析與實踐Coscup x ruby conf tw 2021  google cloud buildpacks 剖析與實踐
Coscup x ruby conf tw 2021 google cloud buildpacks 剖析與實踐
 
Grunt - The JavaScript Task Runner
Grunt - The JavaScript Task RunnerGrunt - The JavaScript Task Runner
Grunt - The JavaScript Task Runner
 
drone continuous Integration
drone continuous Integrationdrone continuous Integration
drone continuous Integration
 
Gitlab - Creating C++ applications with Gitlab CI
Gitlab - Creating C++ applications with Gitlab CIGitlab - Creating C++ applications with Gitlab CI
Gitlab - Creating C++ applications with Gitlab CI
 
Docker as development environment
Docker as development environmentDocker as development environment
Docker as development environment
 
如何透過 Go-kit 快速搭建微服務架構應用程式實戰
如何透過 Go-kit 快速搭建微服務架構應用程式實戰如何透過 Go-kit 快速搭建微服務架構應用程式實戰
如何透過 Go-kit 快速搭建微服務架構應用程式實戰
 
Deploying 3 times a day without a downtime @ Rocket Tech Summit in Berlin
Deploying 3 times a day without a downtime @ Rocket Tech Summit in BerlinDeploying 3 times a day without a downtime @ Rocket Tech Summit in Berlin
Deploying 3 times a day without a downtime @ Rocket Tech Summit in Berlin
 
20111018 1st lt_kom
20111018 1st lt_kom20111018 1st lt_kom
20111018 1st lt_kom
 
Dev fest 2020 taiwan how to debug microservices on kubernetes as a pros (ht...
Dev fest 2020 taiwan   how to debug microservices on kubernetes as a pros (ht...Dev fest 2020 taiwan   how to debug microservices on kubernetes as a pros (ht...
Dev fest 2020 taiwan how to debug microservices on kubernetes as a pros (ht...
 
Bower & Grunt - A practical workflow
Bower & Grunt - A practical workflowBower & Grunt - A practical workflow
Bower & Grunt - A practical workflow
 
Docker at Monoco.jp (LinkedIn)
Docker at Monoco.jp (LinkedIn)Docker at Monoco.jp (LinkedIn)
Docker at Monoco.jp (LinkedIn)
 
Gitlab ci e kubernetes, build test and deploy your projects like a pro
Gitlab ci e kubernetes, build test and deploy your projects like a proGitlab ci e kubernetes, build test and deploy your projects like a pro
Gitlab ci e kubernetes, build test and deploy your projects like a pro
 
容器化後,持續交付不可缺的敲門磚 - Helm
容器化後,持續交付不可缺的敲門磚 - Helm容器化後,持續交付不可缺的敲門磚 - Helm
容器化後,持續交付不可缺的敲門磚 - Helm
 

Ähnlich wie Docker in Production: Reality, Not Hype - DevOps Chicago

Ähnlich wie Docker in Production: Reality, Not Hype - DevOps Chicago (20)

Scaling Next-Generation Internet TV on AWS With Docker, Packer, and Chef
Scaling Next-Generation Internet TV on AWS With Docker, Packer, and ChefScaling Next-Generation Internet TV on AWS With Docker, Packer, and Chef
Scaling Next-Generation Internet TV on AWS With Docker, Packer, and Chef
 
Docker in production: reality, not hype (OSCON 2015)
Docker in production: reality, not hype (OSCON 2015)Docker in production: reality, not hype (OSCON 2015)
Docker in production: reality, not hype (OSCON 2015)
 
Lights, Camera, Docker: Streaming Video at DramaFever
Lights, Camera, Docker: Streaming Video at DramaFeverLights, Camera, Docker: Streaming Video at DramaFever
Lights, Camera, Docker: Streaming Video at DramaFever
 
JDD2014: Docker.io - versioned linux containers for JVM devops - Dominik Dorn
JDD2014: Docker.io - versioned linux containers for JVM devops - Dominik DornJDD2014: Docker.io - versioned linux containers for JVM devops - Dominik Dorn
JDD2014: Docker.io - versioned linux containers for JVM devops - Dominik Dorn
 
Docker in everyday development
Docker in everyday developmentDocker in everyday development
Docker in everyday development
 
Learning Docker with Thomas
Learning Docker with ThomasLearning Docker with Thomas
Learning Docker with Thomas
 
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
Docker summit 2015: 以 Docker Swarm 打造多主機叢集環境
 
Adventures in docker compose
Adventures in docker composeAdventures in docker compose
Adventures in docker compose
 
Deploying Windows Containers on Windows Server 2016
Deploying Windows Containers on Windows Server 2016Deploying Windows Containers on Windows Server 2016
Deploying Windows Containers on Windows Server 2016
 
Ruby microservices with Docker - Sergii Koba
Ruby microservices with Docker -  Sergii KobaRuby microservices with Docker -  Sergii Koba
Ruby microservices with Docker - Sergii Koba
 
Real World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and ProductionReal World Experience of Running Docker in Development and Production
Real World Experience of Running Docker in Development and Production
 
DCEU 18: Developing with Docker Containers
DCEU 18: Developing with Docker ContainersDCEU 18: Developing with Docker Containers
DCEU 18: Developing with Docker Containers
 
Docker and IBM Integration Bus
Docker and IBM Integration BusDocker and IBM Integration Bus
Docker and IBM Integration Bus
 
Clustering Docker with Docker Swarm on openSUSE
Clustering Docker with Docker Swarm on openSUSEClustering Docker with Docker Swarm on openSUSE
Clustering Docker with Docker Swarm on openSUSE
 
Docker Timisoara: Dockercon19 recap slides, 23 may 2019
Docker Timisoara: Dockercon19 recap slides, 23 may 2019Docker Timisoara: Dockercon19 recap slides, 23 may 2019
Docker Timisoara: Dockercon19 recap slides, 23 may 2019
 
How to create your own hack environment
How to create your own hack environmentHow to create your own hack environment
How to create your own hack environment
 
Docker Enterprise Workshop - Technical
Docker Enterprise Workshop - TechnicalDocker Enterprise Workshop - Technical
Docker Enterprise Workshop - Technical
 
Securité des container
Securité des containerSecurité des container
Securité des container
 
Docking with Docker
Docking with DockerDocking with Docker
Docking with Docker
 
Docker primer and tips
Docker primer and tipsDocker primer and tips
Docker primer and tips
 

Mehr von bridgetkromhout

Mehr von bridgetkromhout (20)

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

Docker in Production: Reality, Not Hype - DevOps Chicago