SlideShare a Scribd company logo
1 of 18
Download to read offline
10/17/2013 - Docker @ RelateIQ - Scott Bessler & John Fiedler
Docker @ RelateIQ

@

Scott Bessler
scott@relateiq.com
@scottbessler

John Fiedler
john@relateiq.com
@johnfiedler

Blog
blog.relateiq.com
RelateIQ Twitter
@relateiq

File Repo
https://github.com/relateiq/docker_public
Agenda

● Part 1 - What we did with Docker
● Part 2 - Why we want to replace Chef
● Part 3 - Future plans using Docker
Part 1. Things were getting out of control... Bring on hack day!

+

+
Hack Day!

=

=
What we needed to build
Docker Files

Minimum

Kafka
MongoDB
Redis
Cassandra
Zookeeper
Elasticsearch

Crushing IT

Docker Files

Storm
Jetty
Nginx

+ Private Docker Registry
End product

MAC OS X
$ devenv start

One
Command!

$ devenv-inner start
Kafka

VM

Containers

MongoDB
Redis
Cassandra
Zookeeper

ubuntu

Elasticsearch
Orchestration scripts

devenv.sh (outer)
[up|update|ssh]
●
●

Controls Vagrant
Controls inner script

devenv-inner.sh (inner)
[stop|start|kill|update|status|restart]
●

Controls Docker containers

update(){
start(){

apt-get update

mkdir -p $APPS/zookeeper/data

apt-get install -y lxc-docker

mkdir -p $APPS/zookeeper/logs
ZOOKEEPER=$(docker run 

docker pull server:4444/zookeeper

-d 

docker pull server:4444/redis

-p 2181:2181 

docker pull server:4444/cassandra

-v $APPS/zookeeper/logs:/logs

docker pull server:4444/elasticsearch

server:4444/zookeeper)

docker pull server:4444/mongo

echo "Started ZOOKEEPER in
container $ZOOKEEPER"
echo "Wiring containers together… "

docker pull server:4444/kafka
}

kill/stop(){

(later slide)

echo "Killing all docker containers:"
docker ps | tail -n +2 |cut -d ' ' -f 1 | xargs docker kill
}
Dockerfile’s

Dockerfile

FROM server:4444/oracle-java7

Std Image

RUN apt-get update
RUN apt-get install -y git curl build-essential make gcc wget

RUN cd /opt && wget http://apache.mirrors.pair.com/cassandra/1.2.9/apachecassandra-1.2.9-bin.tar.gz
RUN cd /opt && tar zxf apache-cassandra-*.tar.gz
RUN rm /opt/*.tar.gz
RUN mv /opt/apache-cassandra-* /opt/cassandra

RUN apt-get install -y lsof
#!/bin/bash

echo "Cassandra node
configuration:"
echo $CASS_SEEDS
echo $CASS_TOKEN

start.sh

echo $CASS_LOCAL_IP

HOST=`hostname`
echo "127.0.0.1 $HOST" >>
/etc/hosts

/opt/cassandra/bin/cassandra -f

ADD cassandra.yaml /opt/cassandra/conf/cassandra.yaml
ADD cassandra-env.sh /opt/cassandra/conf/cassandra-env.sh
ADD log4j-server.properties /opt/cassandra/conf/log4j-server.properties
ADD start.sh /opt/cassandra/bin/start.sh
ADD cassandra-topology.properties /opt/cassandra/conf/cassandra-topology.
properties
RUN chmod 755 /opt/cassandra/bin/start.sh
RUN mkdir /logs
...
VOLUME [ "/logs" ]
...
EXPOSE 7000
….
CMD "/opt/cassandra/bin/start.sh"
Networking - port forwarding

Question:
Dude, where’s mongo?
Answer:
Port forwarding
Example:
> Docker file
expose 9999 (dockerfile)

> Docker

Machine
localhost:27019

vagrant
config.vm.forward_port 9999,27019

docker
run -p 9999:27018

docker run -p 8000:9999

> VAGRANT
config.vm.forward_port 27018, 8000

> localhost:8000

docker file
expose 27018
MongoDB

Tip:
Always use the same port if you can

Containers
Networking - connecting two containers

Question:
Kafka: Dude, where’s Zookeeper?

Answer:
Pipework

Machine
vagrant

https://github.com/jpetazzo/pipework

Example:

docker

> startup the container
KAFKA = docker run -e zooip=192.168.1.1

pipework br1

> Pipework
pipework br1 $KAFKA 192.168.1.2
pipework br1 $ZOOKEEPER 192.168.1.1
(dockerfile)
Zookeeper

Tip:
Use this for clustering

Kafka

192.168.1.1

192.168.1.2

Containers
Best practices

What we found

Machine
*Abstraction

●
●
●
●

Data
Logs
Don’t end with tailing
End with foreground
execution
● Start script for runtime
configuration
● 42 layers, combine
Dockerfile lines
● Up Vagrant RAM default

VM
/logs/mongo
/data/mongo

/logs/kafka
/data/kafka

*Standard Data and log dirs
*Static IP

MongoDB

Kafka

*Start Script
*Foreground Execution
*42 layers only

Containers
Chef

4 reasons why we want to replace Chef
with Docker in prod
1. Dynamic Configuration Is Too Complex

Chef
● Dynamic configuration
through complex
attribute system

Docker Dockerfile
● Admittedly less powerful
● What you see is what you
get
● Environment variables
● Inspect environment at
any step
2. External Dependencies Cause Flaky Provisioning

Chef

Docker

● Once it’s in, it’s in.
● Dependencies are
● Even if you change an
external forever
image, only incremental
● Slower. You pay the price
changes need to be sent
on every node deployed
to hosts
● Under load? Want a new
node? Uh oh, the file
download is missing.
● Node creation needs to be
foolproof
● Or just use chef-solo to
bake images
3. Configuration Changes Create an Inconsistent State

Chef

Docker

● Configuration change? Try ● Ship configuration
changes as image deltas
to apply it to running node
● Nearly instant restarts
● Which changes restart
● Easier to be disciplined
which services?
and have each node be
● Removed something?
identical
○ knife ssh
○ tombstone
● Another reason to just bake
images
4. Developers! Developers! Developers!

Chef

Dockerfile

● Typo? Fix it and start from
● Error? Throw it all out.
the previous successful
● Every iteration/test takes:
command
○ Boot time
● Containers encourage
○ Every step
single-purpose instances
● Can’t test every host
(put your monitoring on
● Can’t test every
the host)
combination of cookbooks
○ Monitoring
○ Logging
Part 3. Whats next? What do we want?

What’s Next for Docker @ RelateIQ?
● Replace Chef search (simple node database in
elasticsearch)
● Monitoring via StatsD and/or Datadog
Wish List
● Dockerfile repo/trusted builds (mentioned on dockerdev)
● Centralized Docker host management
● Mac host (no more virtualbox!)
We’re hiring! https://www.relateiq.com/jobs.html

More Related Content

What's hot

DockerCon EU 2015: Continuous Integration with Jenkins, Docker and Compose
DockerCon EU 2015: Continuous Integration with Jenkins, Docker and ComposeDockerCon EU 2015: Continuous Integration with Jenkins, Docker and Compose
DockerCon EU 2015: Continuous Integration with Jenkins, Docker and Compose
Docker, Inc.
 

What's hot (20)

DockerCon EU 2015: Speed Up Deployment: Building a Distributed Docker Registr...
DockerCon EU 2015: Speed Up Deployment: Building a Distributed Docker Registr...DockerCon EU 2015: Speed Up Deployment: Building a Distributed Docker Registr...
DockerCon EU 2015: Speed Up Deployment: Building a Distributed Docker Registr...
 
Activision's Skypilot: Delivering Amazing Game Experiences Through Containeri...
Activision's Skypilot: Delivering Amazing Game Experiences Through Containeri...Activision's Skypilot: Delivering Amazing Game Experiences Through Containeri...
Activision's Skypilot: Delivering Amazing Game Experiences Through Containeri...
 
DockerCon Keynote Ben Golub
DockerCon Keynote Ben GolubDockerCon Keynote Ben Golub
DockerCon Keynote Ben Golub
 
Docker worshop @Twitter - How to use your own private registry
Docker worshop @Twitter - How to use your own private registryDocker worshop @Twitter - How to use your own private registry
Docker worshop @Twitter - How to use your own private registry
 
Dev with Docker WCPHX 2019
Dev with Docker WCPHX 2019Dev with Docker WCPHX 2019
Dev with Docker WCPHX 2019
 
DevOps Practices @Pipedrive
DevOps Practices @PipedriveDevOps Practices @Pipedrive
DevOps Practices @Pipedrive
 
Why I wish I'd Heard of Docker when I was 12 - Finnian Anderson
Why I wish I'd Heard of Docker when I was 12 - Finnian AndersonWhy I wish I'd Heard of Docker when I was 12 - Finnian Anderson
Why I wish I'd Heard of Docker when I was 12 - Finnian Anderson
 
Building a smarter application Stack by Tomas Doran from Yelp
Building a smarter application Stack by Tomas Doran from YelpBuilding a smarter application Stack by Tomas Doran from Yelp
Building a smarter application Stack by Tomas Doran from Yelp
 
DockerDay2015: Docker Security
DockerDay2015: Docker SecurityDockerDay2015: Docker Security
DockerDay2015: Docker Security
 
Rancher presentation august 2017
Rancher presentation august 2017Rancher presentation august 2017
Rancher presentation august 2017
 
Living with microservices at Pipedrive
Living with microservices at PipedriveLiving with microservices at Pipedrive
Living with microservices at Pipedrive
 
DockerCon 2017 - General Session Day 1 - Solomon Hykes
DockerCon 2017 - General Session Day 1 - Solomon HykesDockerCon 2017 - General Session Day 1 - Solomon Hykes
DockerCon 2017 - General Session Day 1 - Solomon Hykes
 
DevFestMN 2017 - Learning Docker and Kubernetes with Openshift
DevFestMN 2017 - Learning Docker and Kubernetes with OpenshiftDevFestMN 2017 - Learning Docker and Kubernetes with Openshift
DevFestMN 2017 - Learning Docker and Kubernetes with Openshift
 
Running Docker in Production - The Good, the Bad and The Ugly
Running Docker in Production - The Good, the Bad and The UglyRunning Docker in Production - The Good, the Bad and The Ugly
Running Docker in Production - The Good, the Bad and The Ugly
 
Become a Docker Power User With Microsoft Visual Studio Code
Become a Docker Power User With Microsoft Visual Studio CodeBecome a Docker Power User With Microsoft Visual Studio Code
Become a Docker Power User With Microsoft Visual Studio Code
 
Docker based-Pipelines with Codefresh
Docker based-Pipelines with CodefreshDocker based-Pipelines with Codefresh
Docker based-Pipelines with Codefresh
 
DockerCon EU 2015: Continuous Integration with Jenkins, Docker and Compose
DockerCon EU 2015: Continuous Integration with Jenkins, Docker and ComposeDockerCon EU 2015: Continuous Integration with Jenkins, Docker and Compose
DockerCon EU 2015: Continuous Integration with Jenkins, Docker and Compose
 
Docker?!?! But I'm a SysAdmin
Docker?!?! But I'm a SysAdminDocker?!?! But I'm a SysAdmin
Docker?!?! But I'm a SysAdmin
 
DCEU 18: Docker Containers in a Serverless World
DCEU 18: Docker Containers in a Serverless WorldDCEU 18: Docker Containers in a Serverless World
DCEU 18: Docker Containers in a Serverless World
 
DockerCon EU 2015: Docker Monitoring
DockerCon EU 2015: Docker MonitoringDockerCon EU 2015: Docker Monitoring
DockerCon EU 2015: Docker Monitoring
 

Viewers also liked

Docker 101: Introduction to Docker
Docker 101: Introduction to DockerDocker 101: Introduction to Docker
Docker 101: Introduction to Docker
Docker, Inc.
 

Viewers also liked (14)

Performance and Scalability for Maps API Sites (Dev Fest '10 Mexico)
Performance and Scalability for Maps API Sites (Dev Fest '10 Mexico)Performance and Scalability for Maps API Sites (Dev Fest '10 Mexico)
Performance and Scalability for Maps API Sites (Dev Fest '10 Mexico)
 
Vagrant
VagrantVagrant
Vagrant
 
Dockerffm meetup 20150113_networking
Dockerffm meetup 20150113_networkingDockerffm meetup 20150113_networking
Dockerffm meetup 20150113_networking
 
pipework - Advanced Docker Networking
pipework - Advanced Docker Networkingpipework - Advanced Docker Networking
pipework - Advanced Docker Networking
 
Pipework: Software-Defined Network for Containers and Docker
Pipework: Software-Defined Network for Containers and DockerPipework: Software-Defined Network for Containers and Docker
Pipework: Software-Defined Network for Containers and Docker
 
Introduction to Docker (and a bit more) at LSPE meetup Sunnyvale
Introduction to Docker (and a bit more) at LSPE meetup SunnyvaleIntroduction to Docker (and a bit more) at LSPE meetup Sunnyvale
Introduction to Docker (and a bit more) at LSPE meetup Sunnyvale
 
Building a network emulator with Docker and Open vSwitch
Building a network emulator with Docker and Open vSwitchBuilding a network emulator with Docker and Open vSwitch
Building a network emulator with Docker and Open vSwitch
 
Big Data Open Source Security LLC: Realtime log analysis with Mesos, Docker, ...
Big Data Open Source Security LLC: Realtime log analysis with Mesos, Docker, ...Big Data Open Source Security LLC: Realtime log analysis with Mesos, Docker, ...
Big Data Open Source Security LLC: Realtime log analysis with Mesos, Docker, ...
 
Docker introduction
Docker introductionDocker introduction
Docker introduction
 
A Gentle Introduction To Docker And All Things Containers
A Gentle Introduction To Docker And All Things ContainersA Gentle Introduction To Docker And All Things Containers
A Gentle Introduction To Docker And All Things Containers
 
Docker by Example - Basics
Docker by Example - Basics Docker by Example - Basics
Docker by Example - Basics
 
Docker 101 - Nov 2016
Docker 101 - Nov 2016Docker 101 - Nov 2016
Docker 101 - Nov 2016
 
containerd and CRI
containerd and CRIcontainerd and CRI
containerd and CRI
 
Docker 101: Introduction to Docker
Docker 101: Introduction to DockerDocker 101: Introduction to Docker
Docker 101: Introduction to Docker
 

Similar to Docker @ RelateIQ Presentation

Scale Big With Docker — Moboom 2014
Scale Big With Docker — Moboom 2014Scale Big With Docker — Moboom 2014
Scale Big With Docker — Moboom 2014
Jérôme Petazzoni
 
Introduction to Docker and Linux Containers @ Cloud Computing Rhein Main
Introduction to Docker and Linux Containers @ Cloud Computing Rhein MainIntroduction to Docker and Linux Containers @ Cloud Computing Rhein Main
Introduction to Docker and Linux Containers @ Cloud Computing Rhein Main
Puja Abbassi
 

Similar to Docker @ RelateIQ Presentation (20)

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 0.11 at MaxCDN meetup in Los Angeles
Docker 0.11 at MaxCDN meetup in Los AngelesDocker 0.11 at MaxCDN meetup in Los Angeles
Docker 0.11 at MaxCDN meetup in Los Angeles
 
Rails in docker
Rails in dockerRails in docker
Rails in docker
 
Powercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptxPowercoders · Docker · Fall 2021.pptx
Powercoders · Docker · Fall 2021.pptx
 
Docking with Docker
Docking with DockerDocking with Docker
Docking with Docker
 
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 Docker: 10 Things We've Learned
Real-World Docker: 10 Things We've Learned  Real-World Docker: 10 Things We've Learned
Real-World Docker: 10 Things We've Learned
 
Building Docker Containers @ Scale
Building Docker Containers @ ScaleBuilding Docker Containers @ Scale
Building Docker Containers @ Scale
 
Scale Big With Docker — Moboom 2014
Scale Big With Docker — Moboom 2014Scale Big With Docker — Moboom 2014
Scale Big With Docker — Moboom 2014
 
Docker in everyday development
Docker in everyday developmentDocker in everyday development
Docker in everyday development
 
Sandbox CI/CD Environments for Everyone [BADCamp 2018]
Sandbox CI/CD Environments for Everyone [BADCamp 2018]Sandbox CI/CD Environments for Everyone [BADCamp 2018]
Sandbox CI/CD Environments for Everyone [BADCamp 2018]
 
Introduction to Docker - Learning containerization XP conference 2016
Introduction to Docker - Learning containerization  XP conference 2016Introduction to Docker - Learning containerization  XP conference 2016
Introduction to Docker - Learning containerization XP conference 2016
 
Adventures in docker compose
Adventures in docker composeAdventures in docker compose
Adventures in docker compose
 
Docker Compose: Docker Configuration for the Real World
Docker Compose:  Docker Configuration for the Real WorldDocker Compose:  Docker Configuration for the Real World
Docker Compose: Docker Configuration for the Real World
 
DevAssistant, Docker and You
DevAssistant, Docker and YouDevAssistant, Docker and You
DevAssistant, Docker and You
 
Nagios Conference 2014 - Spenser Reinhardt - Detecting Security Breaches With...
Nagios Conference 2014 - Spenser Reinhardt - Detecting Security Breaches With...Nagios Conference 2014 - Spenser Reinhardt - Detecting Security Breaches With...
Nagios Conference 2014 - Spenser Reinhardt - Detecting Security Breaches With...
 
Introduction to Docker and Linux Containers @ Cloud Computing Rhein Main
Introduction to Docker and Linux Containers @ Cloud Computing Rhein MainIntroduction to Docker and Linux Containers @ Cloud Computing Rhein Main
Introduction to Docker and Linux Containers @ Cloud Computing Rhein Main
 
Introduction to Docker at the Azure Meet-up in New York
Introduction to Docker at the Azure Meet-up in New YorkIntroduction to Docker at the Azure Meet-up in New York
Introduction to Docker at the Azure Meet-up in New York
 
Introduction of Docker and Docker Compose
Introduction of Docker and Docker ComposeIntroduction of Docker and Docker Compose
Introduction of Docker and Docker Compose
 
The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, OrchestrationThe Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
 

Recently uploaded

Recently uploaded (20)

MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 

Docker @ RelateIQ Presentation

  • 1. 10/17/2013 - Docker @ RelateIQ - Scott Bessler & John Fiedler
  • 2. Docker @ RelateIQ @ Scott Bessler scott@relateiq.com @scottbessler John Fiedler john@relateiq.com @johnfiedler Blog blog.relateiq.com RelateIQ Twitter @relateiq File Repo https://github.com/relateiq/docker_public
  • 3. Agenda ● Part 1 - What we did with Docker ● Part 2 - Why we want to replace Chef ● Part 3 - Future plans using Docker
  • 4. Part 1. Things were getting out of control... Bring on hack day! + + Hack Day! = =
  • 5. What we needed to build Docker Files Minimum Kafka MongoDB Redis Cassandra Zookeeper Elasticsearch Crushing IT Docker Files Storm Jetty Nginx + Private Docker Registry
  • 6. End product MAC OS X $ devenv start One Command! $ devenv-inner start Kafka VM Containers MongoDB Redis Cassandra Zookeeper ubuntu Elasticsearch
  • 7. Orchestration scripts devenv.sh (outer) [up|update|ssh] ● ● Controls Vagrant Controls inner script devenv-inner.sh (inner) [stop|start|kill|update|status|restart] ● Controls Docker containers update(){ start(){ apt-get update mkdir -p $APPS/zookeeper/data apt-get install -y lxc-docker mkdir -p $APPS/zookeeper/logs ZOOKEEPER=$(docker run docker pull server:4444/zookeeper -d docker pull server:4444/redis -p 2181:2181 docker pull server:4444/cassandra -v $APPS/zookeeper/logs:/logs docker pull server:4444/elasticsearch server:4444/zookeeper) docker pull server:4444/mongo echo "Started ZOOKEEPER in container $ZOOKEEPER" echo "Wiring containers together… " docker pull server:4444/kafka } kill/stop(){ (later slide) echo "Killing all docker containers:" docker ps | tail -n +2 |cut -d ' ' -f 1 | xargs docker kill }
  • 8. Dockerfile’s Dockerfile FROM server:4444/oracle-java7 Std Image RUN apt-get update RUN apt-get install -y git curl build-essential make gcc wget RUN cd /opt && wget http://apache.mirrors.pair.com/cassandra/1.2.9/apachecassandra-1.2.9-bin.tar.gz RUN cd /opt && tar zxf apache-cassandra-*.tar.gz RUN rm /opt/*.tar.gz RUN mv /opt/apache-cassandra-* /opt/cassandra RUN apt-get install -y lsof #!/bin/bash echo "Cassandra node configuration:" echo $CASS_SEEDS echo $CASS_TOKEN start.sh echo $CASS_LOCAL_IP HOST=`hostname` echo "127.0.0.1 $HOST" >> /etc/hosts /opt/cassandra/bin/cassandra -f ADD cassandra.yaml /opt/cassandra/conf/cassandra.yaml ADD cassandra-env.sh /opt/cassandra/conf/cassandra-env.sh ADD log4j-server.properties /opt/cassandra/conf/log4j-server.properties ADD start.sh /opt/cassandra/bin/start.sh ADD cassandra-topology.properties /opt/cassandra/conf/cassandra-topology. properties RUN chmod 755 /opt/cassandra/bin/start.sh RUN mkdir /logs ... VOLUME [ "/logs" ] ... EXPOSE 7000 …. CMD "/opt/cassandra/bin/start.sh"
  • 9. Networking - port forwarding Question: Dude, where’s mongo? Answer: Port forwarding Example: > Docker file expose 9999 (dockerfile) > Docker Machine localhost:27019 vagrant config.vm.forward_port 9999,27019 docker run -p 9999:27018 docker run -p 8000:9999 > VAGRANT config.vm.forward_port 27018, 8000 > localhost:8000 docker file expose 27018 MongoDB Tip: Always use the same port if you can Containers
  • 10. Networking - connecting two containers Question: Kafka: Dude, where’s Zookeeper? Answer: Pipework Machine vagrant https://github.com/jpetazzo/pipework Example: docker > startup the container KAFKA = docker run -e zooip=192.168.1.1 pipework br1 > Pipework pipework br1 $KAFKA 192.168.1.2 pipework br1 $ZOOKEEPER 192.168.1.1 (dockerfile) Zookeeper Tip: Use this for clustering Kafka 192.168.1.1 192.168.1.2 Containers
  • 11. Best practices What we found Machine *Abstraction ● ● ● ● Data Logs Don’t end with tailing End with foreground execution ● Start script for runtime configuration ● 42 layers, combine Dockerfile lines ● Up Vagrant RAM default VM /logs/mongo /data/mongo /logs/kafka /data/kafka *Standard Data and log dirs *Static IP MongoDB Kafka *Start Script *Foreground Execution *42 layers only Containers
  • 12. Chef 4 reasons why we want to replace Chef with Docker in prod
  • 13. 1. Dynamic Configuration Is Too Complex Chef ● Dynamic configuration through complex attribute system Docker Dockerfile ● Admittedly less powerful ● What you see is what you get ● Environment variables ● Inspect environment at any step
  • 14. 2. External Dependencies Cause Flaky Provisioning Chef Docker ● Once it’s in, it’s in. ● Dependencies are ● Even if you change an external forever image, only incremental ● Slower. You pay the price changes need to be sent on every node deployed to hosts ● Under load? Want a new node? Uh oh, the file download is missing. ● Node creation needs to be foolproof ● Or just use chef-solo to bake images
  • 15. 3. Configuration Changes Create an Inconsistent State Chef Docker ● Configuration change? Try ● Ship configuration changes as image deltas to apply it to running node ● Nearly instant restarts ● Which changes restart ● Easier to be disciplined which services? and have each node be ● Removed something? identical ○ knife ssh ○ tombstone ● Another reason to just bake images
  • 16. 4. Developers! Developers! Developers! Chef Dockerfile ● Typo? Fix it and start from ● Error? Throw it all out. the previous successful ● Every iteration/test takes: command ○ Boot time ● Containers encourage ○ Every step single-purpose instances ● Can’t test every host (put your monitoring on ● Can’t test every the host) combination of cookbooks ○ Monitoring ○ Logging
  • 17. Part 3. Whats next? What do we want? What’s Next for Docker @ RelateIQ? ● Replace Chef search (simple node database in elasticsearch) ● Monitoring via StatsD and/or Datadog Wish List ● Dockerfile repo/trusted builds (mentioned on dockerdev) ● Centralized Docker host management ● Mac host (no more virtualbox!)