SlideShare uma empresa Scribd logo
1 de 19
D O C K E R F O R
D E V E L O P M E N T
J E F F N I C K O L O F F
• To provide a simple scaffold for:
• rapid iteration
• build, test, lint… release pipeline automation
• Dependency (library, service, etc) management
W H A T I S T H E G O A L ?
A D E V E L O P M E N T E N V I R O N M E N T
• Runtime environment realism
• Develop and iterate in isolation
B E S T P R A C T I C E S
A D E V E L O P M E N T E N V I R O N M E N T
• Build tool management
• “Did you install <tool X>?” “I dunno bud. It works in IntelliJ”
• “We’re upgrading from Maven to <whatever>” *eyes roll*
• Multi-day new team member ramp-up
• Service dependency modeling (database, etc)
• Remote resources: “I need VPN so I can work from the coffee shop / home / etc.”
• Service state (data mutation, schema version)
• Isolation from other local environments
• Environment variable collisions
• Log file collisions
• Port collisions
• Shared (remote) databases
C H A L L E N G E S
A D E V E L O P M E N T E N V I R O N M E N T
– E V E R Y O N E A T S O M E P O I N T
“I know! We’ll just Dockerize the things…”
F I R S T Y O U M A K E A N I M A G E
R I G H T ?
• “It is easy! I just put my binaries in an image right?”
• “Wait, you mean I have to rebuild my image every
time?”
• “Do my build tools need to go all the way to production
if I use them in my development env?”
F I R S T , T H I N K A B O U T Y O U R
P R O B L E M
• I want to iterate quickly when I’m developing local
• I want to model my service dependencies locally
• I want to version my build tooling and configuration
• I want to automate a local build/launch pipeline
T H R E E I M A G E / C O N T A I N E R
P A T T E R N S
• Static(ish) iteration tooling, variable source
• heavy use of volumes
• Static(ish) source, full build tooling
• ONBUILD images
• Release quality artifact, minimal overhead, minimal attack
surface
• FROM scratch or alpine
E X A M P L E E N V I R O N M E N T
• Owned by a team named, “team”
• Go based service named, “proj”
• Repo is “go getable”
• Binaries can be produced outside of the context of a Go workspace
• Build tools:
• Node and GulpJS for workflow automation
• Mocha for integration testing
L O C A L . D F ( F O R I T E R A T I O N )
# Based on minimal Go tooling
FROM golang:alpine
# Environment modeling (Go workspace, path, and runtime flags)
ENV GOPATH=/src/proj PATH=$PATH:/src/proj/bin GODEBUG=netdns=cgo
RUN mkdir -p /src/proj/src/bitbucket.org/team/proj && mkdir -p /src/proj/bin
# Install Git (to pull library deps), Node, and Gulp (for build automation)
RUN apk --update add --no-cache git nodejs
RUN npm install --global gulp
# Install library dependencies in image.
RUN go get github.com/bitly/go-nsq && 
go get github.com/codegangsta/cli && 
go get github.com/gin-gonic/gin && 
go get github.com/rcrowley/go-metrics && 
go get github.com/allingeek/go-metrics-influxdb
# Explicitly define volumes that should be overridden at runtime
VOLUME ["/src/proj/src/bitbucket.org/team/proj", "/src/proj/pkg", "/src/proj/bin"]
# Set the context for local iteration
WORKDIR /src/proj/src/bitbucket.org/team/proj
# Gulp has the iterative build instructions
# The iterative build instructions can change without rebuilding this image
CMD ["gulp"]
B U I L D . D F ( F O R B U I L D I N G B I N S )
# Based on minimal Go tooling
FROM golang:alpine
# Install Git for pulling library dependencies
RUN apk --update add git
# Basic environment stuffs
ENV GODEBUG=netdns=cgo
CMD proj --debug serve
# Copy in sources (and just the sources)
COPY *.go /go/src/bitbucket.org/team/proj/
COPY common /go/src/bitbucket.org/team/proj/common
COPY service /go/src/bitbucket.org/team/proj/service
# Set context, install deps, and (simple) build
WORKDIR /go/src/bitbucket.org/team/proj
RUN go get ./... && go install
R E L E A S E . D F ( R U N N A B L E
I M A G E )
# No Go tooling, just a minimal Linux
FROM alpine
# Set the context and runtime flags
WORKDIR /
ENV PATH=$PATH:/ GODEBUG=netdns=cgo
CMD proj serve
# Add other stuff like EXPOSE / USER here
# Copy in the binary built in another container.
# In a warm env, this is the only layer that should
# ever change. (Fast)
COPY ./bin/proj-exported /proj
T H R E E I M A G E / C O N T A I N E R
P A T T E R N S
• Nobody said you could only use one image, container,
etc.
• Each of the three patterns is appropriate for a
different development phase (see demo).
• Nobody said you can ONLY use Docker.
• Use other common tools like Make or Compose
M O D E L E N V I R O N M E N T S W I T H
C O M P O S E
• Local development is an environment
• Model service dependencies with known initial state
• Include special tooling like integration tests
• Include as many components to mirror a realistic
runtime as possible (databases, dashboards,
logging, mock traffic, etc)
D O C K E R - C O M P O S E . Y M L
( I T E R A T E )
lb:
image: nginx
volumes:
- ./myconf.conf:/etc/nginx/conf.d/myconf.conf
ports:
- 8080:80
proj:
build: .
dockerfile: local.df
D O C K E R - C O M P O S E . Y M L
( I T E R A T E )lb:
image: nginx
volumes:
- ./proj-proxy.conf:/etc/nginx/conf.d/proj-proxy.conf
ports:
- 8080:80
links:
- proj:proj
proj:
build: .
dockerfile: local.df
links:
- db:dbhostname
- cache:cachehostname
db:
image: postgres
cache:
image: redis
integ-test:
build: ./integ
links:
- proj:proj
P U T T I N G I T A L L T O G E T H E R
• All of the tools in the stack should be accessible to the
developer.
• Few of those tools should “define” the experience.
• Pick a primary touch point:
• docker? docker-compose? make? Eclipse?
something else?
A M A K E F I L E
PWD := $(shell pwd)
# cleanup the environment
clean:
rm bin/proj-exported
docker rmi team/proj:dev
# Run NPM in a container and install tools (Gulp & Mocha) in the PWD
prepare:
docker run -it --rm -v "$(shell pwd)":/work -w /work node:4.1.2 npm install
# Start iterating live. This uses docker-compose.yml and local.df.
# GulpJS is performing a full format/build/spawn workflow on every source change.
iterate:
docker-compose up -d
# Stop iterating.
stop:
docker-compose stop
# Build proj during image build. Produce runnable image & copy out the binary
build:
docker build -t team/proj:dev -f dev.df .
docker run --rm -v $(PWD)/bin:/xfer team/proj:dev cp /go/bin/proj /xfer/proj-exported
# Produce a production quality image by injecting only the binary
release: build
docker build -t team/proj -f release.df .
D E M O

Mais conteúdo relacionado

Mais procurados

Virtual Bolt Workshop - 6 May
Virtual Bolt Workshop - 6 MayVirtual Bolt Workshop - 6 May
Virtual Bolt Workshop - 6 MayPuppet
 
Puppet Camp Düsseldorf 2014: Continuously Deliver Your Puppet Code with Jenki...
Puppet Camp Düsseldorf 2014: Continuously Deliver Your Puppet Code with Jenki...Puppet Camp Düsseldorf 2014: Continuously Deliver Your Puppet Code with Jenki...
Puppet Camp Düsseldorf 2014: Continuously Deliver Your Puppet Code with Jenki...Puppet
 
Building a Drupal site with Git
Building a Drupal site with GitBuilding a Drupal site with Git
Building a Drupal site with Gitdirtytactics
 
Shared Object images in Docker: What you need is what you want.
Shared Object images in Docker: What you need is what you want.Shared Object images in Docker: What you need is what you want.
Shared Object images in Docker: What you need is what you want.Workhorse Computing
 
GraphQL IN Golang
GraphQL IN GolangGraphQL IN Golang
GraphQL IN GolangBo-Yi Wu
 
Crafting Beautiful CLI Applications in Ruby
Crafting Beautiful CLI Applications in RubyCrafting Beautiful CLI Applications in Ruby
Crafting Beautiful CLI Applications in RubyNikhil Mungel
 
Deployment Patterns in the Ruby on Rails World
Deployment Patterns in the Ruby on Rails WorldDeployment Patterns in the Ruby on Rails World
Deployment Patterns in the Ruby on Rails WorldNikhil Mungel
 
The Modern Developer Toolbox
The Modern Developer ToolboxThe Modern Developer Toolbox
The Modern Developer ToolboxPablo Godel
 
Gearman work queue in php
Gearman work queue in phpGearman work queue in php
Gearman work queue in phpBo-Yi Wu
 
Modern Infrastructure from Scratch with Puppet
Modern Infrastructure from Scratch with PuppetModern Infrastructure from Scratch with Puppet
Modern Infrastructure from Scratch with PuppetPuppet
 
Scalable Cloud-Native Masterless Puppet, with PuppetDB and Bolt, Craig Watson...
Scalable Cloud-Native Masterless Puppet, with PuppetDB and Bolt, Craig Watson...Scalable Cloud-Native Masterless Puppet, with PuppetDB and Bolt, Craig Watson...
Scalable Cloud-Native Masterless Puppet, with PuppetDB and Bolt, Craig Watson...Puppet
 
2019 11-bgphp
2019 11-bgphp2019 11-bgphp
2019 11-bgphpdantleech
 
Virtual Bolt Workshop, 5 May 2020
Virtual Bolt Workshop, 5 May 2020Virtual Bolt Workshop, 5 May 2020
Virtual Bolt Workshop, 5 May 2020Puppet
 
Automating Large Applications on Modular and Structured Form with Gulp
Automating Large Applications on Modular and Structured Form with GulpAutomating Large Applications on Modular and Structured Form with Gulp
Automating Large Applications on Modular and Structured Form with GulpAnderson Aguiar
 
Composer - Package Management for PHP. Silver Bullet?
Composer - Package Management for PHP. Silver Bullet?Composer - Package Management for PHP. Silver Bullet?
Composer - Package Management for PHP. Silver Bullet?Kirill Chebunin
 
CI : the first_step: Auto Testing with CircleCI - (MOSG)
CI : the first_step: Auto Testing with CircleCI - (MOSG)CI : the first_step: Auto Testing with CircleCI - (MOSG)
CI : the first_step: Auto Testing with CircleCI - (MOSG)Soshi Nemoto
 
Import golang; struct microservice - Codemotion Rome 2015
Import golang; struct microservice - Codemotion Rome 2015Import golang; struct microservice - Codemotion Rome 2015
Import golang; struct microservice - Codemotion Rome 2015Giorgio Cefaro
 

Mais procurados (20)

Virtual Bolt Workshop - 6 May
Virtual Bolt Workshop - 6 MayVirtual Bolt Workshop - 6 May
Virtual Bolt Workshop - 6 May
 
Puppet Camp Düsseldorf 2014: Continuously Deliver Your Puppet Code with Jenki...
Puppet Camp Düsseldorf 2014: Continuously Deliver Your Puppet Code with Jenki...Puppet Camp Düsseldorf 2014: Continuously Deliver Your Puppet Code with Jenki...
Puppet Camp Düsseldorf 2014: Continuously Deliver Your Puppet Code with Jenki...
 
Rest, sockets em golang
Rest, sockets em golangRest, sockets em golang
Rest, sockets em golang
 
Building a Drupal site with Git
Building a Drupal site with GitBuilding a Drupal site with Git
Building a Drupal site with Git
 
Shared Object images in Docker: What you need is what you want.
Shared Object images in Docker: What you need is what you want.Shared Object images in Docker: What you need is what you want.
Shared Object images in Docker: What you need is what you want.
 
GraphQL IN Golang
GraphQL IN GolangGraphQL IN Golang
GraphQL IN Golang
 
Crafting Beautiful CLI Applications in Ruby
Crafting Beautiful CLI Applications in RubyCrafting Beautiful CLI Applications in Ruby
Crafting Beautiful CLI Applications in Ruby
 
Deployment Patterns in the Ruby on Rails World
Deployment Patterns in the Ruby on Rails WorldDeployment Patterns in the Ruby on Rails World
Deployment Patterns in the Ruby on Rails World
 
The Modern Developer Toolbox
The Modern Developer ToolboxThe Modern Developer Toolbox
The Modern Developer Toolbox
 
Gearman work queue in php
Gearman work queue in phpGearman work queue in php
Gearman work queue in php
 
Modern Infrastructure from Scratch with Puppet
Modern Infrastructure from Scratch with PuppetModern Infrastructure from Scratch with Puppet
Modern Infrastructure from Scratch with Puppet
 
Scalable Cloud-Native Masterless Puppet, with PuppetDB and Bolt, Craig Watson...
Scalable Cloud-Native Masterless Puppet, with PuppetDB and Bolt, Craig Watson...Scalable Cloud-Native Masterless Puppet, with PuppetDB and Bolt, Craig Watson...
Scalable Cloud-Native Masterless Puppet, with PuppetDB and Bolt, Craig Watson...
 
Docker perl build
Docker perl buildDocker perl build
Docker perl build
 
2019 11-bgphp
2019 11-bgphp2019 11-bgphp
2019 11-bgphp
 
Virtual Bolt Workshop, 5 May 2020
Virtual Bolt Workshop, 5 May 2020Virtual Bolt Workshop, 5 May 2020
Virtual Bolt Workshop, 5 May 2020
 
Automating Large Applications on Modular and Structured Form with Gulp
Automating Large Applications on Modular and Structured Form with GulpAutomating Large Applications on Modular and Structured Form with Gulp
Automating Large Applications on Modular and Structured Form with Gulp
 
Composer - Package Management for PHP. Silver Bullet?
Composer - Package Management for PHP. Silver Bullet?Composer - Package Management for PHP. Silver Bullet?
Composer - Package Management for PHP. Silver Bullet?
 
Front-end tools
Front-end toolsFront-end tools
Front-end tools
 
CI : the first_step: Auto Testing with CircleCI - (MOSG)
CI : the first_step: Auto Testing with CircleCI - (MOSG)CI : the first_step: Auto Testing with CircleCI - (MOSG)
CI : the first_step: Auto Testing with CircleCI - (MOSG)
 
Import golang; struct microservice - Codemotion Rome 2015
Import golang; struct microservice - Codemotion Rome 2015Import golang; struct microservice - Codemotion Rome 2015
Import golang; struct microservice - Codemotion Rome 2015
 

Semelhante a Docker for Development

Deliver Python Apps with Docker
Deliver Python Apps with DockerDeliver Python Apps with Docker
Deliver Python Apps with DockerAnton Egorov
 
Настройка окружения для кросскомпиляции проектов на основе docker'a
Настройка окружения для кросскомпиляции проектов на основе docker'aНастройка окружения для кросскомпиляции проектов на основе docker'a
Настройка окружения для кросскомпиляции проектов на основе docker'acorehard_by
 
LXC to Docker Via Continuous Delivery
LXC to Docker Via Continuous DeliveryLXC to Docker Via Continuous Delivery
LXC to Docker Via Continuous DeliveryDocker, Inc.
 
Django dev-env-my-way
Django dev-env-my-wayDjango dev-env-my-way
Django dev-env-my-wayRobert Lujo
 
From Zero to Hero - All you need to do serious deep learning stuff in R
From Zero to Hero - All you need to do serious deep learning stuff in R From Zero to Hero - All you need to do serious deep learning stuff in R
From Zero to Hero - All you need to do serious deep learning stuff in R Kai Lichtenberg
 
Toolbox of a Ruby Team
Toolbox of a Ruby TeamToolbox of a Ruby Team
Toolbox of a Ruby TeamArto Artnik
 
Introduction to Docker at SF Peninsula Software Development Meetup @Guidewire
Introduction to Docker at SF Peninsula Software Development Meetup @GuidewireIntroduction to Docker at SF Peninsula Software Development Meetup @Guidewire
Introduction to Docker at SF Peninsula Software Development Meetup @GuidewiredotCloud
 
Odo improving the developer experience on OpenShift - hack &amp; sangria
Odo   improving the developer experience on OpenShift - hack &amp; sangriaOdo   improving the developer experience on OpenShift - hack &amp; sangria
Odo improving the developer experience on OpenShift - hack &amp; sangriaJorge Morales
 
Large-scaled Deploy Over 100 Servers in 3 Minutes
Large-scaled Deploy Over 100 Servers in 3 MinutesLarge-scaled Deploy Over 100 Servers in 3 Minutes
Large-scaled Deploy Over 100 Servers in 3 MinutesHiroshi SHIBATA
 
Docker module 1
Docker module 1Docker module 1
Docker module 1Liang Bo
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014biicode
 
Road to sbt 1.0 paved with server
Road to sbt 1.0   paved with serverRoad to sbt 1.0   paved with server
Road to sbt 1.0 paved with serverEugene Yokota
 
SCM Puppet: from an intro to the scaling
SCM Puppet: from an intro to the scalingSCM Puppet: from an intro to the scaling
SCM Puppet: from an intro to the scalingStanislav Osipov
 
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20Michael Lihs
 
Docker and-containers-for-development-and-deployment-scale12x
Docker and-containers-for-development-and-deployment-scale12xDocker and-containers-for-development-and-deployment-scale12x
Docker and-containers-for-development-and-deployment-scale12xrkr10
 
Docker in development
Docker in developmentDocker in development
Docker in developmentsethvoltz
 
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 environmentSumedt Jitpukdebodin
 
Docker engine - Indroduc
Docker engine - IndroducDocker engine - Indroduc
Docker engine - IndroducAl Gifari
 
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...Nagios
 

Semelhante a Docker for Development (20)

Deliver Python Apps with Docker
Deliver Python Apps with DockerDeliver Python Apps with Docker
Deliver Python Apps with Docker
 
Настройка окружения для кросскомпиляции проектов на основе docker'a
Настройка окружения для кросскомпиляции проектов на основе docker'aНастройка окружения для кросскомпиляции проектов на основе docker'a
Настройка окружения для кросскомпиляции проектов на основе docker'a
 
LXC to Docker Via Continuous Delivery
LXC to Docker Via Continuous DeliveryLXC to Docker Via Continuous Delivery
LXC to Docker Via Continuous Delivery
 
Django dev-env-my-way
Django dev-env-my-wayDjango dev-env-my-way
Django dev-env-my-way
 
From Zero to Hero - All you need to do serious deep learning stuff in R
From Zero to Hero - All you need to do serious deep learning stuff in R From Zero to Hero - All you need to do serious deep learning stuff in R
From Zero to Hero - All you need to do serious deep learning stuff in R
 
Toolbox of a Ruby Team
Toolbox of a Ruby TeamToolbox of a Ruby Team
Toolbox of a Ruby Team
 
Introduction to Docker at SF Peninsula Software Development Meetup @Guidewire
Introduction to Docker at SF Peninsula Software Development Meetup @GuidewireIntroduction to Docker at SF Peninsula Software Development Meetup @Guidewire
Introduction to Docker at SF Peninsula Software Development Meetup @Guidewire
 
Odo improving the developer experience on OpenShift - hack &amp; sangria
Odo   improving the developer experience on OpenShift - hack &amp; sangriaOdo   improving the developer experience on OpenShift - hack &amp; sangria
Odo improving the developer experience on OpenShift - hack &amp; sangria
 
Large-scaled Deploy Over 100 Servers in 3 Minutes
Large-scaled Deploy Over 100 Servers in 3 MinutesLarge-scaled Deploy Over 100 Servers in 3 Minutes
Large-scaled Deploy Over 100 Servers in 3 Minutes
 
Docker as development environment
Docker as development environmentDocker as development environment
Docker as development environment
 
Docker module 1
Docker module 1Docker module 1
Docker module 1
 
Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014Dependencies Managers in C/C++. Using stdcpp 2014
Dependencies Managers in C/C++. Using stdcpp 2014
 
Road to sbt 1.0 paved with server
Road to sbt 1.0   paved with serverRoad to sbt 1.0   paved with server
Road to sbt 1.0 paved with server
 
SCM Puppet: from an intro to the scaling
SCM Puppet: from an intro to the scalingSCM Puppet: from an intro to the scaling
SCM Puppet: from an intro to the scaling
 
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
Continuous Integration with Open Source Tools - PHPUgFfm 2014-11-20
 
Docker and-containers-for-development-and-deployment-scale12x
Docker and-containers-for-development-and-deployment-scale12xDocker and-containers-for-development-and-deployment-scale12x
Docker and-containers-for-development-and-deployment-scale12x
 
Docker in development
Docker in developmentDocker in development
Docker in development
 
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 engine - Indroduc
Docker engine - IndroducDocker engine - Indroduc
Docker engine - Indroduc
 
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...
 

Mais de allingeek

Why we got to Docker
Why we got to DockerWhy we got to Docker
Why we got to Dockerallingeek
 
Retiring Service Interfaces: A Retrospective on Two 10+ Year Old Services
Retiring Service Interfaces: A Retrospective on Two 10+ Year Old ServicesRetiring Service Interfaces: A Retrospective on Two 10+ Year Old Services
Retiring Service Interfaces: A Retrospective on Two 10+ Year Old Servicesallingeek
 
Getting Deep on Orchestration - Nickoloff - DockerCon16
Getting Deep on Orchestration - Nickoloff - DockerCon16Getting Deep on Orchestration - Nickoloff - DockerCon16
Getting Deep on Orchestration - Nickoloff - DockerCon16allingeek
 
Docker: Aspects of Container Isolation
Docker: Aspects of Container IsolationDocker: Aspects of Container Isolation
Docker: Aspects of Container Isolationallingeek
 
Single Host Docker Networking
Single Host Docker NetworkingSingle Host Docker Networking
Single Host Docker Networkingallingeek
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Dockerallingeek
 

Mais de allingeek (6)

Why we got to Docker
Why we got to DockerWhy we got to Docker
Why we got to Docker
 
Retiring Service Interfaces: A Retrospective on Two 10+ Year Old Services
Retiring Service Interfaces: A Retrospective on Two 10+ Year Old ServicesRetiring Service Interfaces: A Retrospective on Two 10+ Year Old Services
Retiring Service Interfaces: A Retrospective on Two 10+ Year Old Services
 
Getting Deep on Orchestration - Nickoloff - DockerCon16
Getting Deep on Orchestration - Nickoloff - DockerCon16Getting Deep on Orchestration - Nickoloff - DockerCon16
Getting Deep on Orchestration - Nickoloff - DockerCon16
 
Docker: Aspects of Container Isolation
Docker: Aspects of Container IsolationDocker: Aspects of Container Isolation
Docker: Aspects of Container Isolation
 
Single Host Docker Networking
Single Host Docker NetworkingSingle Host Docker Networking
Single Host Docker Networking
 
Introduction to Docker
Introduction to DockerIntroduction to Docker
Introduction to Docker
 

Último

%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
Generic or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsBert Jan Schrijver
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Hararemasabamasaba
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...masabamasaba
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyviewmasabamasaba
 
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...masabamasaba
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfayushiqss
 

Último (20)

%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Generic or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisions
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Vancouver Psychic Readings, Attraction spells,Br...
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 

Docker for Development

  • 1. D O C K E R F O R D E V E L O P M E N T J E F F N I C K O L O F F
  • 2. • To provide a simple scaffold for: • rapid iteration • build, test, lint… release pipeline automation • Dependency (library, service, etc) management W H A T I S T H E G O A L ? A D E V E L O P M E N T E N V I R O N M E N T
  • 3. • Runtime environment realism • Develop and iterate in isolation B E S T P R A C T I C E S A D E V E L O P M E N T E N V I R O N M E N T
  • 4. • Build tool management • “Did you install <tool X>?” “I dunno bud. It works in IntelliJ” • “We’re upgrading from Maven to <whatever>” *eyes roll* • Multi-day new team member ramp-up • Service dependency modeling (database, etc) • Remote resources: “I need VPN so I can work from the coffee shop / home / etc.” • Service state (data mutation, schema version) • Isolation from other local environments • Environment variable collisions • Log file collisions • Port collisions • Shared (remote) databases C H A L L E N G E S A D E V E L O P M E N T E N V I R O N M E N T
  • 5. – E V E R Y O N E A T S O M E P O I N T “I know! We’ll just Dockerize the things…”
  • 6. F I R S T Y O U M A K E A N I M A G E R I G H T ? • “It is easy! I just put my binaries in an image right?” • “Wait, you mean I have to rebuild my image every time?” • “Do my build tools need to go all the way to production if I use them in my development env?”
  • 7. F I R S T , T H I N K A B O U T Y O U R P R O B L E M • I want to iterate quickly when I’m developing local • I want to model my service dependencies locally • I want to version my build tooling and configuration • I want to automate a local build/launch pipeline
  • 8. T H R E E I M A G E / C O N T A I N E R P A T T E R N S • Static(ish) iteration tooling, variable source • heavy use of volumes • Static(ish) source, full build tooling • ONBUILD images • Release quality artifact, minimal overhead, minimal attack surface • FROM scratch or alpine
  • 9. E X A M P L E E N V I R O N M E N T • Owned by a team named, “team” • Go based service named, “proj” • Repo is “go getable” • Binaries can be produced outside of the context of a Go workspace • Build tools: • Node and GulpJS for workflow automation • Mocha for integration testing
  • 10. L O C A L . D F ( F O R I T E R A T I O N ) # Based on minimal Go tooling FROM golang:alpine # Environment modeling (Go workspace, path, and runtime flags) ENV GOPATH=/src/proj PATH=$PATH:/src/proj/bin GODEBUG=netdns=cgo RUN mkdir -p /src/proj/src/bitbucket.org/team/proj && mkdir -p /src/proj/bin # Install Git (to pull library deps), Node, and Gulp (for build automation) RUN apk --update add --no-cache git nodejs RUN npm install --global gulp # Install library dependencies in image. RUN go get github.com/bitly/go-nsq && go get github.com/codegangsta/cli && go get github.com/gin-gonic/gin && go get github.com/rcrowley/go-metrics && go get github.com/allingeek/go-metrics-influxdb # Explicitly define volumes that should be overridden at runtime VOLUME ["/src/proj/src/bitbucket.org/team/proj", "/src/proj/pkg", "/src/proj/bin"] # Set the context for local iteration WORKDIR /src/proj/src/bitbucket.org/team/proj # Gulp has the iterative build instructions # The iterative build instructions can change without rebuilding this image CMD ["gulp"]
  • 11. B U I L D . D F ( F O R B U I L D I N G B I N S ) # Based on minimal Go tooling FROM golang:alpine # Install Git for pulling library dependencies RUN apk --update add git # Basic environment stuffs ENV GODEBUG=netdns=cgo CMD proj --debug serve # Copy in sources (and just the sources) COPY *.go /go/src/bitbucket.org/team/proj/ COPY common /go/src/bitbucket.org/team/proj/common COPY service /go/src/bitbucket.org/team/proj/service # Set context, install deps, and (simple) build WORKDIR /go/src/bitbucket.org/team/proj RUN go get ./... && go install
  • 12. R E L E A S E . D F ( R U N N A B L E I M A G E ) # No Go tooling, just a minimal Linux FROM alpine # Set the context and runtime flags WORKDIR / ENV PATH=$PATH:/ GODEBUG=netdns=cgo CMD proj serve # Add other stuff like EXPOSE / USER here # Copy in the binary built in another container. # In a warm env, this is the only layer that should # ever change. (Fast) COPY ./bin/proj-exported /proj
  • 13. T H R E E I M A G E / C O N T A I N E R P A T T E R N S • Nobody said you could only use one image, container, etc. • Each of the three patterns is appropriate for a different development phase (see demo). • Nobody said you can ONLY use Docker. • Use other common tools like Make or Compose
  • 14. M O D E L E N V I R O N M E N T S W I T H C O M P O S E • Local development is an environment • Model service dependencies with known initial state • Include special tooling like integration tests • Include as many components to mirror a realistic runtime as possible (databases, dashboards, logging, mock traffic, etc)
  • 15. D O C K E R - C O M P O S E . Y M L ( I T E R A T E ) lb: image: nginx volumes: - ./myconf.conf:/etc/nginx/conf.d/myconf.conf ports: - 8080:80 proj: build: . dockerfile: local.df
  • 16. D O C K E R - C O M P O S E . Y M L ( I T E R A T E )lb: image: nginx volumes: - ./proj-proxy.conf:/etc/nginx/conf.d/proj-proxy.conf ports: - 8080:80 links: - proj:proj proj: build: . dockerfile: local.df links: - db:dbhostname - cache:cachehostname db: image: postgres cache: image: redis integ-test: build: ./integ links: - proj:proj
  • 17. P U T T I N G I T A L L T O G E T H E R • All of the tools in the stack should be accessible to the developer. • Few of those tools should “define” the experience. • Pick a primary touch point: • docker? docker-compose? make? Eclipse? something else?
  • 18. A M A K E F I L E PWD := $(shell pwd) # cleanup the environment clean: rm bin/proj-exported docker rmi team/proj:dev # Run NPM in a container and install tools (Gulp & Mocha) in the PWD prepare: docker run -it --rm -v "$(shell pwd)":/work -w /work node:4.1.2 npm install # Start iterating live. This uses docker-compose.yml and local.df. # GulpJS is performing a full format/build/spawn workflow on every source change. iterate: docker-compose up -d # Stop iterating. stop: docker-compose stop # Build proj during image build. Produce runnable image & copy out the binary build: docker build -t team/proj:dev -f dev.df . docker run --rm -v $(PWD)/bin:/xfer team/proj:dev cp /go/bin/proj /xfer/proj-exported # Produce a production quality image by injecting only the binary release: build docker build -t team/proj -f release.df .
  • 19. D E M O