Upgrade to Pro — share decks privately, control downloads, hide ads and more …

NLUUG 2014: Zero to Docker in 20s

NLUUG 2014: Zero to Docker in 20s

Steeve Morin

May 15, 2014

Transcript

37 slides
  1. THE MATRIX FROM HELL My Machine Your Machine QA Staging

    Prod Web App ? ? ? ? ? Backoffice ? ? ? ? ? Queue ? ? ? ? ? Workers ? ? ? ? ? DB ? ? ? ? ?
  2. THE MATRIX FROM HELL ? ? ? ? ? ?

    ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
  3. WHY IT WORKS • Separation of concerns • Goods are

    packed as containers • Shipping companies only care about shipping containers • Everything built around containers
  4. LINUX CONTAINERS • Since Linux 3.0 • But only use

    from 3.8 • Shared kernel • Isolated processes • Startup is fast (100ms fast) • Very light
  5. 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
  6. THE MATRIX FROM HELL My Machine Your Machine QA Staging

    Prod Web App Backoffice Queue Workers DB
  7. FOR DEVS • My code • My libraries • My

    dependencies • My linux distribution • My data
  8. FOR OPS • Logging • Network access • Monitoring •

    Permissions, throttling • CPU, RAM, DISK
  9. 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
  10. 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 <container_id> myapp $ docker tag myapp steeve/myapp $ docker push steeve/myapp
  11. 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
  12. 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
  13. 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!
  14. –Steeve Morin “When you think about it, the host system

    is redundant to the Docker image… Right?”
  15. TINY CORE LINUX • 9mb ISO (!) • Runs from

    RAM • Boots in 3s • v4.7 at the time (5.3 now) • Binary repository • Pretty big community
  16. 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!!!
  17. DOCKER ON TCL $ docker run -i -t busybox /bin/sh


    lxc-start: Invalid argument - pivot_root syscall failed
  18. DOCKER ON TCL: PART DEUX • December 3rd, 2013 •

    Docker Global Hack Day • Better custom Kernel • 3.10/AUFS/CGROUPS… • Custom LXC patch
  19. • 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
  20. $ boot2docker-cli init $ boot2docker-cli up $ export DOCKER_HOST=localhost $

    docker run -i -t busybox sh #/ boot2docker-cli + boot2docker OS + Docker OSX client = <3

More Decks by Steeve Morin

Other Decks in Technology