The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

119

description

An introduction to Docker, its ecosystem, and information on deploying and orchestrating docker.

Transcript of The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

Page 1: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Page 2: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Page 3: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Page 4: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Page 5: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Page 6: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Page 7: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Page 8: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Page 9: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

Deploy servicesreliably & consistently

• If it works locally, it will work on the server

• With exactly the same behavior

• Regardless of versions

• Regardless of distros

• Regardless of dependencies

Page 10: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Page 11: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

Just like the real thing

• Work in dev environment

• Other services (databases etc.) in containers

• Whenever you want to test « for real »:

• Build in seconds

• Run instantly

Page 12: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

Better! Faster! Stronger!

Better! Faster! Stronger!

Page 13: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

15 Months Later: An Incredible Platform and Ecosystem

Official Repos & 14K+ Dockerized Apps

Community 460+ Contributors 250+ Meetups on Docker 2.75M Downloads 6.7K Projects on GitHub

Support Enterprise Support Robust Documentation Implementation, Integration, Training Network of Partners

The Docker Platform ! Docker Engine

Docker Hub !Build, Ship, and Run

Partners

Content

Users

Page 14: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

55 People and a Turtle

Now up to 55 people (and our pet turtle, Gordon)

Page 15: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

…to Build, Ship, and Run

Build Ship

Run

Dev

QA

Source

Staging

Physical

Virtual

Cloud

Infrastructure Management

Infrastructure Management

DockerFile

Source Code Repository

TESTTEST

TESTTEST

TEST

GCE RAX IBM

Mac/Win Dev Machine

Boot2Docker

Doc

ker

Analytics DB

Prod Machine

Linux OS

Doc

ker

Doc

ker

++

Users Collab

Provenance Policy

Docker Hub

Registries

Public Curated Private

Docker Hub API

Third Party Tools

Prod Machine

Linux OS

Doc

ker

Doc

ker

Prod Machine

Linux OS

Doc

ker

Doc

ker

VM

Doc

ker

Doc

ker

VM

Doc

ker

Doc

ker

VM

Doc

ker

Doc

ker

QA Machine

Linux OS

Doc

ker

Doc

ker

Page 16: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

An Open Platform…

API

Engine Hub

open source software at the heart of the Docker platform

cloud-based platform services for distributed applications

API

Page 17: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

An Introduction to the Docker Engine

Page 18: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

It’s an image builder.

Page 19: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

Database

HTTP Service HTTP Service HTTP Service

Haproxy Haproxy

Quagga Quagga

BGP / OSPF

Database

{{{

image #1:your-favorite-lb

image #2:apache, nginx, etc

image #3:mysql, zookeeper, etc

Page 20: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

Zookeeper

HTTP Service HTTP Service HTTP Service

Haproxy Haproxy

Quagga Quagga

BGP / OSPF

Zookeeper

{{

image #1:your-favorite-lb

image #2:consensus-web-service

Zookeeper

Page 21: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Page 22: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

Do it!‣ Satisfied with your local build?

‣ Push it to a registry (public or private)

‣ Run it (automatically!) in CI/CD

‣ Run it in production

‣ Happiness!

‣ Something goes wrong? Rollback painlessly!

Page 23: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

Demo!

Page 24: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

Installing Docker on EC2#!/bin/bash -xaws ec2 run-instances \ --image-id ami-e55a648c \ --key-name mykey \ --user-data \ ”#include https://get.docker.io"

Page 25: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

#!/bin/bash -x aws ec2 run-instances \ --image-id ami-e55a648c \ --key-name my-key \ --user-data "#include https://get.docker.io” ip=$(aws ec2 describe-instances \ --output json \ --filter Name=instance-state-name,Values=running | python \ -c 'import json; import sys; print json.load(sys.stdin)[“Reservations”][0]["Instances"][0]["PublicIpAddress"]') ssh ubuntu@$ip sudo docker run cirros

Page 26: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Page 27: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Page 28: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Page 29: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Page 30: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Page 31: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Page 32: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Page 33: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Page 34: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

An ecosystem

libcontainer libchan

libswarm45Tuesday, June 10, 14

Engine + + DockerHub

Page 35: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

libcontainer… a story of Linux namespaces

Page 36: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

libcontainer…

• Standalone project

• Contributors:

• RedHat

• Google

• Parallels (OpenVZ)

• Ubuntu / LXC

Page 37: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Page 38: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Page 39: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Page 40: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Page 41: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Page 42: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Page 43: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Page 44: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

User namespace

Page 45: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Page 46: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Page 47: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Page 48: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Page 49: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Page 50: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Page 51: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Page 52: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

Security

Page 53: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

misconceptions

• Docker is not secure

• Docker should be compared to VM security

Page 54: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Page 55: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

a security product

• Docker Engine is a security product.

• It provides a wrapper around processes

• Provides a path toward attestation of arbitrary processes (Trusted Compute)

• You can use VMs to wrap containers

Page 56: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

a work in progress…

That said…

Security was not a priority for the 1.0 release

Security is a priority post-1.0

Big issues are still be discovered at a rapid clip…

Big issues are being resolved at a rapid clip.

Page 57: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

libchana lightweight communication

protocol for distributed systems

25Tuesday, June 10, 14

Page 58: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

d

libchanLike Go channels over the network

Simple message passing

Synchronization without sharing state

Raw socket passing: channels as gateways to any other protocol

Nesting: channels can send channels

26Tuesday, June 10, 14

Page 59: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

libchan

Available transports:SPDY/TLS,websocket,raw TCP,high-perf unix sockets (with fd passing),in-memory go channels.

Designed to be simple and portable

27Tuesday, June 10, 14

Page 60: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

libswarmA minimalist toolkit

to compose network services

39Tuesday, June 10, 14

Page 61: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

libswarmA standard interface to combine and organize

services in a distributed system.

Compose complex architectures from standard building blocks

Avoid vendor lock-in by swapping any service out with another

Pick services from a built-in library, or write your own with a simple API.

40Tuesday, June 10, 14

Page 62: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

Shipper or Mesos or Coreos/FleetGeardor

or or orConsul Helios Centurion

EC2 Rackspace GCE Orchard Tutum

38Tuesday, June 10, 14

Page 63: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

Images… and a new way of looking

at infrastructure

Page 64: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

Images on HWis usually mutable

Hardware

Image

Linux

Chef

Installs Chef

Image'

Linux

Chef

Creates

Replaces

Runs

Page 65: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

Ephemeral environmentsare (somewhat) immutable.

Hypervisor

Image

Linux

Chef

Runs

Image'

Linux

Chef

Chef

Runs

Configures

VM

Accesses

COW

Page 66: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

Containers are like ephemeral VMs

Docker

Image

Linux

Chef

Runs

Image'

Linux

Chef

Chef

Runs

Configures

Container

Accesses

COW

Hypervisor

Image

Linux

Chef

Runs

Image'

Linux

Chef

Chef

Runs

Configures

VM

Accesses

COW

Hypervisor

VM Docker

Container

Page 67: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

Chef-for-runtime

$ cat Dockerfile FROM fedora RUN yum update; \ yum -y install chef

ADD http://x/receipes.tar.gz /opt/chef"ADD solo.rb /etc/chef/solo.rb"CMD chef-solo -c /etc/chef/solo.rb ; \! apachectl start

Page 68: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Page 69: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Page 70: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Page 71: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Page 72: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Page 73: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Page 74: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

Containersare

THINGS

Page 75: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

X

Page 76: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

X

Page 77: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Page 78: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

Servers vs Things

Pets vs Cattle

Page 79: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

LET US BAKEIMAGES!

Let us

BAKE

images!

Page 80: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

Burning configuration into images.

Docker ContainerInitiates Creates

Image

Linux

Chef

Chef

Runs

Configures

Build Creates

Page 81: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Page 82: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

Bakery Chef

$ cat Dockerfile FROM fedora RUN yum update; \ yum -y install chef"ADD http://x/receipes.tar.gz /opt/chef"ADD solo.rb /etc/chef/solo.rb"RUN chef-solo -c /etc/chef/solo.rb

Page 83: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

Expanded view:Burning configuration into

images.

Docker Image tagInitiates

Image'

Linux

Chef

Chef

Build

Image

Linux

Chef

Creates

Creates

Runs Creates

References1

2

Page 84: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Page 85: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Page 86: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

Anatomy of a Docker+Chef build & run

Docker ContainerInitiates Creates

Image

Linux

Chef

Chef

Runs

Configures

Chef

Runs

Configures

Build Creates

Stage 1 Stage 2

Page 87: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

For All The Things!

$ cat Dockerfile FROM fedora RUN yum update; \ yum -y install chef ADD http://x/receipes.tar.gz /opt/chef"ADD solo-stage1.rb /etc/chef/solo-stage1.rb"ADD solo-stage2.rb /etc/chef/solo-stage2.rb"RUN chef-solo -c /etc/chef/solo-stage1.rb"CMD chef-solo -c /etc/chef/solo-stage2.rb; \" apachectl start

Page 88: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

Does it converge?

$ docker build —rm . $ echo $? # pass or fail

(This is great use of Docker as an alternative to VMs for testing Chef recipes targeting non-Docker production systems)

Page 89: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

Managing Docker at scale

Page 90: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

Creating Containers is Easy

Page 91: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

Managing them SUCKS

needs improvement

Page 92: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

Management Ecosystem

Mesos

FlynnClockerClusterHQ

Page 93: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

PaaS ecosystem

Page 94: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

Configuration / Infrastructure Management

• Chef

• Puppet

• Salt

• Ansible

• CFEngine

• etc…

Page 95: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

Container Inventory

• discoverd / sdutil • serf • skydock • others?

Page 96: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

Change Management Tools

Page 97: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

Chef# using https://github.com/bflad/chef-docker $ cat cookbooks/docker-registry/default.rb# Pull latest image docker_image 'samalba/docker-registry' !# Run container exposing ports docker_container 'samalba/docker-registry' do detach true port '5000:5000' env 'SETTINGS_FLAVOR=local' volume '/mnt/docker:/docker-storage' end $ knife ec2 server create # yada yada yada

Page 98: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

Chef container$ knife container docker init docker -r 'recipe[apache2]' -z -b

Page 99: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

Puppetdocker::run { 'helloworld': image => 'base', command => '/bin/sh -c "while true; do echo hello world; sleep 1; done"', ports => ['4444', '4555'], links => ['mysql:db'], use_name => true, volumes => ['/var/lib/couchdb', '/var/log'], volumes_from => '6446ea52fbc9', memory_limit => 10485760, # bytes username => 'example', hostname => 'example.com', env => ['FOO=BAR', 'FOO2=BAR2'], dns => ['8.8.8.8', '8.8.4.4'], restart_service => true, }

Page 100: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

Ansible- hosts: web sudo: yes tasks: - name: ensure redis container is running docker: image=crosbymichael/redis name=redis - name: ensure redis_ambassador container is running docker: image=svendowideit/ambassador ports=6379:6379 links=redis:redis name=redis_ambassador_ansible

Page 101: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

Orchestration

Page 102: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

fig - local orchestration——fig.yml——web: build: . command: python app.py ports: - "5000:5000" volumes: - .:/code links: - redis  redis: image: orchardup/redis

Page 103: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

figleaf - containerized fig

Testing / dev: $ docker run --privileged -v $PWD:/opt/figapp ewindisch/figleaf

Production - image generation: $ echo “FROM ewindisch/figleaf” >> Dockerfile$ docker build -t my_img .$ docker run —privileged my_img

figleaf images may be plugged into “dumb” orchestration.

Page 104: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

7KH�'RFNHU�SOXJLQ�IRU�+HDW%\�XVLQJ�WKH�SOXJLQ��+HDW�FDQ�WDON�GLUHFWO\�WR�'RFNHU

Orchestration for Dockerwith OpenStack Heat

DockerInc::Docker::Container

VMs

Baremetal

Page 105: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

Heat Workflow

Heat API

VM

Docker

NovaNova resource

Docker resource

Container1

Container2

Container3

HOT

Page 106: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

heat_template_version: 2013-05-23 description: shared volumes example resources: my_instance: type: OS::Nova::Server properties: key_name: ewindisch_key image: ubuntu-precise flavor: m1.large user_data: #include https://get.docker.io ftp_container: type: DockerInc::Docker::Container properties: docker_endpoint: { get_attr: [my_instance, first_address] } image: mikz/vsftpd ports: [ “21:21” ] volumes: [ “/ftp” ] name: “FTP”

apache_container: type: DockerInc::Docker::Container properties: docker_endpoint: { get_attr: [my_instance, first_address] } image: fedora/apache ports: [ “80:80” ] volumes-from: “FTP” cmd: “rm -rf /var/www; ln -s /ftp /var/www; /run-apache.sh”

Page 107: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

OpenStack’s new container service…

nova-api

nova-compute

instance

instance

docker

containers-api

swarm-proxy

docker

keystone

neutron

User

Page 108: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

OpenStack’s new container service…

nova-api

nova-compute

instance

instance

docker

containers-api

swarm-proxy

docker

keystone

neutron

User

Page 109: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

OpenStack’s new container service…

nova-api

nova-compute

instance

instance

docker

containers-api

swarm-proxy

docker

keystone

neutron

User

swarmd

Page 110: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

OSC%Client%Use%Case%

$%source%./openrc%

$%osc%containerIcreate%IIport%pub:222:22%IIdaemon%IIimage%<uuid>%IIcmd%“/usr/sbin/sshd%–D”%

$%osc%containerIshow%DEADBEEF%|%grep%ports%ports:%[12.34.56.78:222]%$%ssh%Ip%222%12.34.56.78%foo$%

From: https://wiki.openstack.org/w/images/5/51/Containers_Proposal.pdf

Page 111: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

Docker%Client%Use%Case%

$%source%./openrc%

$%export%DOCKER_SERVER=h:ps://…%$%docker%run%Ip%pub:222:22%Id%foo%/usr/sbin/sshd%ID%DEADBEEF%

$%osc%containerIshow%DEADBEEF%|%grep%ports%ports:%[12.34.56.78:222]%$%ssh%Ip%222%12.34.56.78%

foo$%

From: https://wiki.openstack.org/w/images/5/51/Containers_Proposal.pdf

Page 112: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

<insert here>Mesos,

Clocker,

Fleet,

Flynn,

Deis,

Kubernetes,

etc

Page 113: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

Conclusion…

Page 114: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

X

Page 115: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

X

Page 116: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

Containersare

THINGS

Page 117: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

Docker is a valuable component in your

security story.

Page 118: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration
Page 119: The Docker "Gauntlet" - Introduction, Ecosystem, Deployment, Orchestration

Q & A

@ewindisch