Slide 1

Slide 1 text

GETTING STARTED WITH DOCKER / Lee Jones @scribblethink image source: docker.com

Slide 2

Slide 2 text

LONELY PLANET Web Operations Engineer

Slide 3

Slide 3 text

WHAT IS DOCKER? Docker allows you to package an application with all of its dependencies into a standardized unit for so ware development. docker.com/what-docker

Slide 4

Slide 4 text

TOOLS + WORKFLOWS

Slide 5

Slide 5 text

SOFTWARE LIFECYCLE DEVELOP -> TEST -> DEPLOY -> OPERATE docker can be leveraged at each point

Slide 6

Slide 6 text

SIMPLIFY LOCAL DEVELOPMENT SETUP bin/setup

Slide 7

Slide 7 text

VIDEOS 2 WATCH A web application for noting videos that you want to watch later. 2 components Ruby on Rails web application Postgresql database

Slide 8

Slide 8 text

TOOLS

Slide 9

Slide 9 text

TERMINOLOGY is a good reference for terminology docs.docker.com

Slide 10

Slide 10 text

DOCKER (ENGINE) client daemon (server) image source: docs.docker.com

Slide 11

Slide 11 text

IMAGE The read-only artifact that Docker "builds" Images contain one or more layers.

Slide 12

Slide 12 text

DOCKERFILE The blueprint for building an image

Slide 13

Slide 13 text

DOCKERIZE Adding docker to a project

Slide 14

Slide 14 text

TAG A human readable reference to a specific image

Slide 15

Slide 15 text

REGISTRY A public or private repository where images are stored

Slide 16

Slide 16 text

CONTAINER The execution environment where your service or task runs

Slide 17

Slide 17 text

DOCKER COMPOSE A tool for orchestrating containers in development

Slide 18

Slide 18 text

DOCKER MACHINE A tool for managing docker hosts

Slide 19

Slide 19 text

INSTALLATION Install on , , or . Linux Mac Windows

Slide 20

Slide 20 text

DOCKER TOOLBOX recommended method for Mac or Windows users (for now) image source: docker.com

Slide 21

Slide 21 text

DOCKER MACHINE image source: docs.docker.com

Slide 22

Slide 22 text

DOCKER FOR MAC AND WINDOWS Docker announced beta on March 24, 2016. Docker for Mac and Windows

Slide 23

Slide 23 text

HELLO-WORLD docker run hello-world

Slide 24

Slide 24 text

OUTPUT $> docker run hello-world Hello from Docker. This message shows that your installation appear To generate this message, Docker took the follow 1. The Docker client contacted the Docker daemo 2. The Docker daemon pulled the "hello-world"

Slide 25

Slide 25 text

DOCKER HUB You can find the on Docker Hub. hello-world image

Slide 26

Slide 26 text

DOCKERFILE FROM scratch COPY hello / CMD ["/hello"]

Slide 27

Slide 27 text

WORKFLOWS

Slide 28

Slide 28 text

VIDEOS 2 WATCH EXAMPLE EXPLAINED Understanding what's going on in bin/setup.

Slide 29

Slide 29 text

DOCKERFILE FROM ruby:2.2.4 RUN apt-get update -qq && apt-get install -y bui RUN mkdir /videos2watch WORKDIR /videos2watch ADD Gemfile /videos2watch/Gemfile ADD Gemfile.lock /videos2watch/Gemfile.lock RUN bundle install ADD . /videos2watch

Slide 30

Slide 30 text

DOCKER-COMPOSE.YML version: '2' services: db: image: postgres:9.1 web: build: . command: bundle exec unicorn -p 3000 -o volumes:

Slide 31

Slide 31 text

CONFIG/DATABASE.YML development: &development adapter: postgresql database: videos2watch_development username: postgres password: host: db test: &test

Slide 32

Slide 32 text

BIN/SETUP echo "## Starting Postgresql..." docker-compose up -d db sleep 5 # wait for database to start echo "## Setting up databases..." docker-compose run --rm web rake db:setup docker-compose run --rm -e RAILS_ENV=test web ra

Slide 33

Slide 33 text

DOCKER MACHINE

Slide 34

Slide 34 text

EDIT A VIEW

Slide 35

Slide 35 text

TEST SUITE

Slide 36

Slide 36 text

CONSOLE

Slide 37

Slide 37 text

LEARN MORE (I highly recommend) (they are really good) The Docker Book Docker Docs Best practices for writing Dockerfiles

Slide 38

Slide 38 text

THANK YOU! The slides, notes, and Dockerfile from this presentation are available at . github.com/leejones/docker-lunch-and-learn / Lee Jones @scribblethink