Slide 1

Slide 1 text

BOOT2DOCKER Zero to Docker in 20s Steeve Morin
 @steeve

Slide 2

Slide 2 text

‘SUP • @steeve • independent, always for hire • -ista • wingsuiter (because fuck yeah)

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

–Every developer ever “Works on my machine.”

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

It’s a pretty big problem.

Slide 7

Slide 7 text

THE MATRIX FROM HELL My Machine Your Machine QA Staging Prod Web App ? ? ? ? ? Backoffice ? ? ? ? ? Queue ? ? ? ? ? Workers ? ? ? ? ? DB ? ? ? ? ?

Slide 8

Slide 8 text

THE MATRIX FROM HELL ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

Slide 9

Slide 9 text

THE SHIPPING CONTAINER

Slide 10

Slide 10 text

WHY IT WORKS • Separation of concerns • Goods are packed as containers • Shipping companies only care about shipping containers • Everything built around containers

Slide 11

Slide 11 text

THE MATRIX FROM HELL

Slide 12

Slide 12 text

LINUX CONTAINERS • Since Linux 3.0 • But only use from 3.8 • Shared kernel • Isolated processes • Startup is fast (100ms fast) • Very light

Slide 13

Slide 13 text

DOCKER IS CONTAINERS FOR SOFTWARE • Lightweight virtualization • Leverages Linux Containers • No performance hit (unlike VMs *wink wink*) • Devs supply docker images • Ops deploy and run docker images

Slide 14

Slide 14 text

THE MATRIX FROM HELL My Machine Your Machine QA Staging Prod Web App Backoffice Queue Workers DB

Slide 15

Slide 15 text

FOR DEVS • My code • My libraries • My dependencies • My linux distribution • My data

Slide 16

Slide 16 text

FOR OPS • Logging • Network access • Monitoring • Permissions, throttling • CPU, RAM, DISK

Slide 17

Slide 17 text

WORKFLOW • git like (commit, tag, push, pull) • Run image in container • Modify container as needed • Commit container as new image • Tag complete image • Push image when ready

Slide 18

Slide 18 text

YOUR FIRST CONTAINER $ docker run -i -t ubuntu bash /# apt-get -y update /# apt-get install -y python /# wget http://srv/myapp.zip /# unzip myapp.zip $ docker commit myapp $ docker tag myapp steeve/myapp $ docker push steeve/myapp

Slide 19

Slide 19 text

THE DOCKERFILE • A standard way to build Docker images • Very simple syntax and limited scope • It’s simply run/commit ! • The whole environment in one file

Slide 20

Slide 20 text

THE DOCKERFILE $ cat Dockerfile FROM debian:jessie ! RUN apt-get -y update RUN apt-get install -y python ! ADD myapp / ! EXPOSE 8080 CMD ["python", “/myapp/app.py"] $ docker build -t steeve/myapp $ docker run steeve/myapp

Slide 21

Slide 21 text

THE DOCKER REGISTRY • Repository of public Docker images • http://index.docker.io • docker push to the registry • Can run registry locally • Registry is simply a Docker image!

Slide 22

Slide 22 text

BOOT2DOCKER

Slide 23

Slide 23 text

–Steeve Morin “When you think about it, the host system is redundant to the Docker image… Right?”

Slide 24

Slide 24 text

TINY CORE LINUX • 9mb ISO (!) • Runs from RAM • Boots in 3s • v4.7 at the time (5.3 now) • Binary repository • Pretty big community

Slide 25

Slide 25 text

DOCKER ON TCL • First try, July 2013 • Linux Kernel 3.0 x86 without AUFS? • Custom Linux 3.10 with AUFS • Missing critical packages? • Cross compilation FTW • docker version works!!!

Slide 26

Slide 26 text

DOCKER ON TCL $ docker run -i -t busybox /bin/sh
 lxc-start: Invalid argument - pivot_root syscall failed

Slide 27

Slide 27 text

DOCKER ON TCL: PART DEUX • December 3rd, 2013 • Docker Global Hack Day • Better custom Kernel • 3.10/AUFS/CGROUPS… • Custom LXC patch

Slide 28

Slide 28 text

DOCKER ON TCL $ docker run -i -t busybox /bin/sh
 #/

Slide 29

Slide 29 text

• Based on Tiny Core Linux 5.1 • 25mb ISO, boots in 5-10s • Runs from RAM, read-only • updates are easy • Disk persistance • Built with Docker • Yes, boot2docker builds with boot2docker

Slide 30

Slide 30 text

0.9.1 (just released)

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

130 000 downloads

Slide 33

Slide 33 text

$ boot2docker-cli init $ boot2docker-cli up $ export DOCKER_HOST=localhost $ docker run -i -t busybox sh #/ boot2docker-cli + boot2docker OS + Docker OSX client = <3

Slide 34

Slide 34 text

No content

Slide 35

Slide 35 text

No content

Slide 36

Slide 36 text

No content

Slide 37

Slide 37 text

THANK YOU github.com/boot2docker/boot2docker @steeve