Docker 101

Meet the portable future



Presented at PyOhio on 7/26/14

About me

Andrew T. Baker
Python consultant in Washington, DC
Django-district co-organizer
Spin-docker side project





About you

Today


  • Short presentation covering docker basics
  • Self-paced tutorials
  • Informal, collaborative feel
  • Ask questions anytime!

What is docker?

LXC?

Virtualization tool?





Configuration manager?
VM manager?
Fancy cgroups?

Docker is something new



Docker.io says:

Docker is an open-source engine that automates the deployment of any application as a lightweight, portable, self-sufficient container that will run virtually anywhere. 

App portability

Manual
configuration
Configuration
management tools
Traditional VMs
Docker
Environment agnostic
Environment specific


Source: docker.io 

Source: docker.io 

Typical docker architecture


Rule of thumb: One container for each process
Source: quay.io 

Why is this a big deal?


It takes us one big step closer to
commoditization of computing services

Docker basics

Containers

Applications run in containers. 

To create a container, you need a docker image and a command to execute:
$ docker run busybox /bin/echo foobar >> /tmp/foo.txthello world

Images

Saved states of containers. 

To create an image, you commit changes you made in a container:
$ docker commit -m "Add foo.txt" e25605a6d745 atbaker/foobar

Dockerfiles (builder)

Scripts with a series of commands to build docker images:
# Spin-docker example dockerfile for a Django project

# Use phusion/baseimage as base image
FROM phusion/baseimage:0.9.8

MAINTAINER Andrew T. Baker <andrew@andrewtorkbaker.com># Add the Django app and install its requirements
ADD sd_sample_project /var/www/django
RUN apt-get install -y python-pip
RUN pip install virtualenv
RUN virtualenv /var/www/venv
RUN /.../venv/bin/pip install -r /.../requirements.txt...

Docker hub



Git for deployment?


Docker Git Description
image repository collection of commits
container clone used for local execution
docker hub GitHub popular remote server

An open-source
success story

  • dotCloud side project revealed at PyCon 2013 
  • Since then:
    • Downloaded 1,000,000+ times
    • Powers 300+ projects
    • 350+ docker contributors
    • 10,000+ GitHub stars
  • dotCloud changes its name to Docker

  • 1.0 released in June 2014!
     
    Source: docker.io 
    Source: docker.io 

    What are people
    doing with docker?

    Development environments


    Platform-as-a-Service (Paas)




    Continuous Integration (CI)


    Educational sandboxes


    And the tools are
    getting better too

    GUIs


    Cloud hosting

    (additional free credit for you today!)

    Getting better all the time

    Just these past couple months!

    The Docker Weekly email newsletter is a great way to stay in touch.

    Questions?

    If not, it's tutorial time!

    Intro tutorial

    For people new to docker. Covers:
    • Docker basics
    • Dockerizing your own apps
    • Managing your development environments with Fig


    Advanced tutorial

    If you finish the intro material - a survey of different docker projects, plus an exercise to get you working with the docker API.
    • Learn how to use Drone, Deis, and Tutum
    • Play with the docker API
    • Or, just talk with other folks about Docker

    Tutorial repo



    Cloud server signup


    There's only one of me! Please help your neighbors if you can.

    Thanks!

    Docker 101

    By Andrew T. Baker

    Docker 101

    Presented at PyOhio on 7/26/14

    • 21,969