Introduction to Docker

Andrew T. Baker

Blog:

http://www.andrewtorkbaker.com

 

Twitter:

@andrewtorkbaker

 

Docker Hub:

atbaker

Today

  • What is Docker?

  • Docker vocabulary

  • Docker's past, present, and future

  • Your future in the cloud

  • Questions

Virtualization tool?

Configuration manager?

VM manager?

cgroups?

LXC?

libvirt?

go?

Docker.com says

Docker is an open platform for developers and sysadmins to build, ship, and run distributed applications.

Docker Engine

A portable, lightweight runtime and packaging tool

Docker Hub

A cloud service for sharing applications and automating workflows

Less portable, minimal overhead

Most portable,
lots of overhead

Manual
configuration

Traditional VMs

CM tools

Docker

Containers

Your applications run in containers

$ docker run busybox /bin/echo "hello world"
hello world
docker run [OPTIONS] IMAGE [COMMAND] [ARG...]

Images

Saved states of containers. 

$ docker history atbaker/sd-django
IMAGE               CREATED             CREATED BY                                      SIZE
2c69173d3c3e        6 months ago        /bin/sh -c apt-get clean && rm -rf /var/lib/a   7 B
cf07ee82aaa6        6 months ago        /bin/sh -c chown root /opt/sd_client.py /var/   1.162 kB
4a3046bdcd25        6 months ago        /bin/sh -c #(nop) ADD file:0854b61af5a8f7051c   259 B
519ac326d2de        6 months ago        /bin/sh -c #(nop) ADD file:03065d55ff7e64caa9   896 B
5f87ccb7c84f        6 months ago        /bin/sh -c chown root /etc/service/gunicorn/r   871 B
aa069b102781        6 months ago        /bin/sh -c #(nop) ADD file:4683e735d1f7a57fd5   864 B
da64e86860ea        6 months ago        /bin/sh -c mkdir /etc/service/gunicorn          7 B
9109839d1887        6 months ago        /bin/sh -c touch /var/log/gunicorn/error.log    7 B
5e628a947f45        6 months ago        /bin/sh -c touch /var/log/gunicorn/access.log   7 B
57b25445ef0b        6 months ago        /bin/sh -c mkdir /var/log/gunicorn              7 B
dc008bbf46e8        6 months ago        /bin/sh -c /var/www/venv/bin/django-admin.py    747.5 kB
d75444a0b891        6 months ago        /bin/sh -c /var/www/venv/bin/django-admin.py    45.49 kB
4b6f8f5021aa        6 months ago        /bin/sh -c #(nop) ENV SECRET_KEY=no-so-secret   0 B
93a3749a8817        6 months ago        /bin/sh -c #(nop) ENV DJANGO_SETTINGS_MODULE=   0 B
3d67fca00fe8        6 months ago        /bin/sh -c #(nop) ENV PYTHONPATH=$PYTHONPATH:   0 B
1b2851b048f7        6 months ago        /bin/sh -c /var/www/venv/bin/pip install -r /   30.19 MB
7c9a3b2daefb        6 months ago        /bin/sh -c virtualenv /var/www/venv             11.62 MB
6b468cc8cefe        6 months ago        /bin/sh -c pip install virtualenv               1.921 MB

Dockerfiles (builder)

Series of commands to build an image

# 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

Repository

Git

Repository

collection of commits

Container

Checkout

used for local execution

Docker Hub

GitHub

popular remote server

Image

Commit

saved state

An open-source 

success story

  • dotCloud side project revealed at PyCon 2013 
  • Since then:
    • 100 million Docker Engine downloads
    • 45,000 "Dockerized" applications in Docker Hub
    • 720+ community contributors
    • 18,000+ GitHub stars
  • dotCloud changes its name to Docker

1.0 released in June 2014

Source: Docker tweet

Source: Docker blog

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

boot2docker

Docker library images

GUIs

Cloud-agnostic hosting

Container-specific hosting

Container-specific hosting

Container-specific hosting

What's next
for Docker?

2014

  • Get to 1.0 (production-ready)
  • Establish partnerships
  • Round out some rough edges (v1.3)

2015

  • Make Docker easier to use
  • Popularize best practices for scaling
  • "Include more batteries" (w/o cannibalizing ecosystem)
  • Address security concerns

Containers,
the cloud, and you

A new player

Cloud computing average monthly cost

Switching clouds
in minutes for...

  • Service outages
  • CPU/Network/IO performance 
  • Special pricing tailored just for you

Containers give you the flexibility to do it

Questions

[Backup slides]

About you

Introduction to Docker (Codementor.io)

By Andrew T. Baker

Introduction to Docker (Codementor.io)

Deck used in my "Introduction to Docker" Codementor.io Office Hours.

  • 35,819