LXC, Docker, and the future of software delivery Linuxcon New - - PowerPoint PPT Presentation

lxc docker and the future of software delivery
SMART_READER_LITE
LIVE PREVIEW

LXC, Docker, and the future of software delivery Linuxcon New - - PowerPoint PPT Presentation

LXC, Docker, and the future of software delivery Linuxcon New Orleans, 2013 Jrme Petazzoni, dotCloud Inc. Outline Why Linux Containers? What are Linux Containers exactly? What do we need on top of LXC? Why Docker?


slide-1
SLIDE 1

LXC, Docker, and the future of software delivery

Linuxcon – New Orleans, 2013 Jérôme Petazzoni, dotCloud Inc.

slide-2
SLIDE 2

Outline

  • Why Linux Containers?
  • What are Linux Containers exactly?
  • What do we need on top of LXC?
  • Why Docker?
  • What is Docker exactly?
  • Where is it going?
slide-3
SLIDE 3

Why Linux Containers?

What are we trying to solve?

slide-4
SLIDE 4

The Matrix From Hell

slide-5
SLIDE 5

The Matrix From Hell

slide-6
SLIDE 6

Many payloads

  • backend services (API)
  • databases
  • distributed stores
  • webapps
slide-7
SLIDE 7

Many payloads

  • Go
  • Java
  • Node.js
  • PHP
  • Python
  • Ruby
slide-8
SLIDE 8

Many payloads

  • CherryPy
  • Django
  • Flask
  • Plone
  • ...
slide-9
SLIDE 9

Many payloads

  • Apache
  • Gunicorn
  • uWSGI
  • ...
slide-10
SLIDE 10

Many payloads

+ your code

slide-11
SLIDE 11

Many targets

  • your local development environment
  • your coworkers' developement environment
  • your Q&A team's test environment
  • some random demo/test server
  • the staging server(s)
  • the production server(s)
  • bare metal
  • virtual machines
  • shared hosting

+ your dog's Raspberry Pi

slide-12
SLIDE 12

Many targets

  • BSD
  • Linux
  • OS X
  • Windows
slide-13
SLIDE 13

Many targets

  • BSD
  • Linux
  • OS X
  • Windows
slide-14
SLIDE 14

The Matrix From Hell

Static website

? ? ? ? ? ? ?

Web frontend

? ? ? ? ? ? ?

background workers

? ? ? ? ? ? ?

User DB

? ? ? ? ? ? ?

Analytics DB

? ? ? ? ? ? ?

Queue

? ? ? ? ? ? ?

Development VM QA Server Single Prod Server Onsite Cluster Public Cloud Contributor’s laptop Customer Servers

slide-15
SLIDE 15

Real-world analogy: containers

slide-16
SLIDE 16

Many products

  • clothes
  • electronics
  • raw materials
  • wine
slide-17
SLIDE 17

Many transportation methods

  • ships
  • trains
  • trucks
  • ...
slide-18
SLIDE 18

Another matrix from hell

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?

slide-19
SLIDE 19

Solution to the transport problem: the intermodal shipping container

slide-20
SLIDE 20

Solution to the transport problem: the intermodal shipping container

  • 90% of all cargo now shipped in a standard container
  • faster and cheaper to load and unload on ships

(by an order of magnitude)

  • less theft, less damage
  • freight cost used to be >25% of final goods cost,

now <3%

  • 5000 ships deliver 200M containers per year
slide-21
SLIDE 21

Solution to the deployment problem:

the Linux container

slide-22
SLIDE 22

Linux containers...

  • run everywhere

– regardless of kernel version – regardless of host distro – (but container and host architecture must match)

  • run anything

– if it can run on the host, it can run in the container – i.e., if it can run on a Linux kernel, it can run

slide-23
SLIDE 23

What are Linux Containers exactly?

slide-24
SLIDE 24

High level approach: it's a lightweight VM

  • own process space
  • own network interface
  • can run stuff as root
  • can have its own /sbin/init

(different from the host)

slide-25
SLIDE 25

Low level approach: it's chroot on steroids

  • can also not have its own /sbin/init
  • container = isolated process(es)
  • share kernel with host
  • no device emulation (neither HVM nor PV)
slide-26
SLIDE 26

Separation of concerns: Dave the Developer

  • inside my container:

– my code – my libraries – my package manager – my app – my data

slide-27
SLIDE 27

Separation of concerns: Oscar the Ops guy

  • outside the container:

– logging – remote access – network configuration – monitoring

slide-28
SLIDE 28

How does it work? Isolation with namespaces

  • pid
  • mnt
  • net
  • uts
  • ipc
  • user
slide-29
SLIDE 29

How does it work? Isolation with cgroups

  • memory
  • cpu
  • blkio
  • devices
slide-30
SLIDE 30

Efficiency: almost no overhead

  • processes are isolated,

but run straight on the host

  • CPU performance = native performance
  • memory performance = a few % shaved off for

(optional) accounting

  • network performance = small overhead; can

be optimized to zero overhead

slide-31
SLIDE 31

Efficiency: storage-friendly

  • unioning filesystems

(AUFS, overlayfs)

  • snapshotting filesystems

(BTRFS, ZFS)

  • copy-on-write

(thin snapshots with LVM or device-mapper)

This wasn't part of LXC at first; but you definitely want it!

slide-32
SLIDE 32

Efficiency: storage-friendly

  • provisioning now takes a few milliseconds
  • … and a few kilobytes
  • creating a new base/image/whateveryoucallit

takes a few seconds

slide-33
SLIDE 33

Docker

slide-34
SLIDE 34

What's Docker?

  • Open Source engine to commoditize LXC
  • using copy-on-write for quick provisioning
  • allowing to create and share images
  • propose a standard format for containers
slide-35
SLIDE 35

Yes, but...

  • « I don't need Docker; I can do all that stuff

with LXC tools, rsync, some scripts! »

  • correct on all accounts; but it's also true for

apt, dpkg, rpm, yum, etc.

  • the whole point is to commoditize,

i.e. make it ridiculously easy to use

slide-36
SLIDE 36

Docker: authoring images

  • you can author « images »

– either with « run+commit » cycles, taking

snapshots

– or with a Dockerfile (=source code for a container) – both ways, it's ridiculously easy

  • you can run them

– anywhere – multiple times

slide-37
SLIDE 37

Dockerfile example

FROM ubuntu RUN apt-get -y update RUN apt-get install -y g++ RUN apt-get install -y erlang-dev erlang-manpages erlang-base-hipe ... RUN apt-get install -y libmozjs185-dev libicu-dev libtool ... RUN apt-get install -y make wget RUN wget http://.../apache-couchdb-1.3.1.tar.gz | tar -C /tmp -zxf- RUN cd /tmp/apache-couchdb-* && ./configure && make install RUN printf "[httpd]\nport = 8101\nbind_address = 0.0.0.0" > /usr/local/etc/couchdb/local.d/docker.ini EXPOSE 8101 CMD ["/usr/local/bin/couchdb"]

slide-38
SLIDE 38

Docker: sharing images

  • you can push/pull images to/from a registry

(public or private)

  • you can search images through a public index
  • dotCloud maintains a collection of base

images (Ubuntu, Fedora...)

  • satisfaction guaranteed or your money back
slide-39
SLIDE 39

Docker: not sharing images

  • private registry

– for proprietary code – or security credentials – or fast local access

slide-40
SLIDE 40

Typical workflow

  • code in local environment

(« dockerized » or not)

  • each push to the git repo triggers a hook
  • the hook tells a build server to clone the code and run

« docker build » (using the Dockerfile)

  • the containers are tested (nosetests, Jenkins...),

and if the tests pass, pushed to the registry

  • production servers pull the containers and run them
  • for network services, load balancers are updated
slide-41
SLIDE 41

Hybrid clouds

  • Docker is part of OpenStack « Havana »,

as a Nova driver + Glance translator

  • typical workflow:

– code on local environment – push container to Glance-backed registry – run and manage containers using OpenStack APIs

  • Docker confirmed to work with:

Digital Ocean, EC2, Joyent, Linode, and many more (not praising a specific vendor, just pointing that it « just works »)

slide-42
SLIDE 42

Docker: the community

  • Docker: >160 contributors
  • latest milestone (0.6): 40 contributors
  • GitHub repository: >600 forks
slide-43
SLIDE 43

Docker: the ecosystem

  • CoreOS (full distro based on Docker)
  • Deis (PAAS; available)
  • Dokku (mini-Heroku in 100 lines of bash)
  • Flynn (PAAS; in development)
  • Maestro (orchestration from a simple YAML file)
  • OpenStack integration
  • Shipper (fabric-like orchestration)

And many more

slide-44
SLIDE 44

Docker roadmap

  • Today: Docker 0.6

– LXC – AUFS

  • Tomorrow: Docker 0.7

– LXC – device-mapper thin snapshots (target: RHEL)

  • The day after: Docker 1.0

– LXC, libvirt, qemu, KVM, OpenVZ, chroot… – multiple storage back-ends – plugins

slide-45
SLIDE 45

Thank you! Questions?

http://docker.io/ https://github.com/dotcloud/docker @docker @jpetazzo