Top Banner
Patrick Chanezon & Tim Park Microsoft @chanezon @timpark
104
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Docker Ecosystem on Azure

Patrick Chanezon & Tim ParkMicrosoft@chanezon @timpark

Page 2: Docker Ecosystem on Azure

French

Polyglot

Server Side

San Francisco

Developer Relations

@chanezon

Page 3: Docker Ecosystem on Azure

3

Devops TED Working Group

Page 4: Docker Ecosystem on Azure
Page 5: Docker Ecosystem on Azure

5

Cloud Market

PublicHybridPrivate

IT Pros Devops DevelopersArchitects

Page 6: Docker Ecosystem on Azure

History of containerization

1960’s mainframe

1990’s hardware virtualization

1990’s OS virt precursors: BSD Jails, Solaris zones

2006 Cloud IaaS

2009 platform virtualization (PaaS)

2013 Docker

See @bcantrill’s deck http://www.slideshare.net/bcantrill/docker-and-the-future-of-containers-in-production

Page 7: Docker Ecosystem on Azure

7

Page 8: Docker Ecosystem on Azure
Page 9: Docker Ecosystem on Azure

Linux Container Ecosystem

Page 10: Docker Ecosystem on Azure

Containers

Page 11: Docker Ecosystem on Azure

Engaging with the ecosystem

Page 12: Docker Ecosystem on Azure
Page 13: Docker Ecosystem on Azure
Page 14: Docker Ecosystem on Azure

It looks like a VM

Private process space

Can run stuff as root

Private network interface and IP address

Custom routes, iptables rules, etc.

Can mount filesystems and more

Page 15: Docker Ecosystem on Azure

Faster to boot, less overhead than a VM

$ time docker run ubuntu echo hello worldhello worldreal 0m0.258s

Disk usage: less than 100 kB

Memory usage: less than 1.5 MB

Page 16: Docker Ecosystem on Azure

Isolation using Linux kernel features

namespaces

pid

mnt

net

uts

ipc

user

cgroups

memory

cpu

blkio

devices

Page 17: Docker Ecosystem on Azure

How does it work?Copy-on-write storage

Create a new machine instantly(Instead of copying its whole filesystem)

Storage keeps track of what has changed

Multiple storage plugins available(AUFS, device mapper, BTRFS, overlayfs, VFS)

Page 18: Docker Ecosystem on Azure

Union Filesystems(AUFS, overlayfs)

Copy-on-writeblock devices

Snapshotting filesystems

Provisioning SuperfastSupercheap

AverageCheap

FastCheap

Changingsmall files

SuperfastSupercheap

FastCostly

FastCheap

Changinglarge files

Slow (first time)Inefficient (copy-up!)

FastCheap

FastCheap

Diffing Superfast Slow Superfast

Memory usage Efficient Inefficient(at high densities)

Inefficient(but may improve)

Drawbacks Random quirksAUFS not mainlineOverlayfs bleeding edge

Higher disk usageGreat performance (except diffing)

ZFS not mainlineBTRFS not as nice

Bottom line Ideal for PAAS, CI/CD, high density things

Works everywhere,but slow and inefficient

Will be great once memory usage is fixed

Storage options

Page 19: Docker Ecosystem on Azure

Initial goals

LXC container engine to build a PaaS

Containers as lightweight VMs(complete with syslog, cron, ssh...)

Part of a bigger puzzle(other parts: builders, load balancers...)

Page 20: Docker Ecosystem on Azure

Docker now

Build, ship, and run any app, anywhere

Page 21: Docker Ecosystem on Azure

Say again?

Build: package your application in a container

Ship: move that container from a machine to another

Run: execute that container (i.e. your application)

Any application: anything that runs on Linux

Anywhere: local VM, cloud instance, bare metal...

Page 22: Docker Ecosystem on Azure

build

Page 23: Docker Ecosystem on Azure

Dockerfiles

Recipe to build a container

Start FROM a base image

RUN commands on top of it

Easy to learn, easy to use

Page 24: Docker Ecosystem on Azure

Authoring imageswith a Dockerfile

Minimal learning curve

Rebuilds are easy

Caching system makes rebuilds faster

Single file to define the whole environment

Single file to define the whole component

Page 25: Docker Ecosystem on Azure

FROM ubuntu:14.04

RUN apt-get updateRUN apt-get install -y nginxRUN echo 'Hi, I am in your container!' \

>/usr/share/nginx/html/index.html

CMD nginx -g "daemon off;"

EXPOSE 80

docker build -t jpetazzo/web .docker run -d -P jpetazzo/web

Page 26: Docker Ecosystem on Azure

Docker language stacks

Page 27: Docker Ecosystem on Azure

« docker build » goodness

Takes a snapshot after each step

Re-uses those snapshots in future builds

Doesn't re-run slow steps (package install...)when it is not necessary

Page 28: Docker Ecosystem on Azure
Page 29: Docker Ecosystem on Azure

ship

Page 30: Docker Ecosystem on Azure

Docker Hub

docker push an image to the Hub

docker pull this image from any machine

Page 31: Docker Ecosystem on Azure

Why does this

matter?

Page 32: Docker Ecosystem on Azure

Deploy reliably & consistently

Images are self-contained, independent from host

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 33: Docker Ecosystem on Azure

run

Page 34: Docker Ecosystem on Azure

Execution is fast and lightweight

Containers have no* overhead Lies, damn lies, and other benchmarks:http://qiita.com/syoyo/items/bea48de8d7c6d8c73435

http://www.slideshare.net/BodenRussell/kvm-and-docker-lxc-benchmarking-with-openstack

*For some definitions of « no »

Page 35: Docker Ecosystem on Azure

Is there really no overhead at all?

Processes are isolated,but run straight on the host

Code path in containers= code path on native

CPU performance = native performance

Memory performance = a few % shaved off for (optional) accounting

Network and disk I/O performance = small overhead; can be reduced to zero

Page 36: Docker Ecosystem on Azure

Deploy almost anywhere

Page 37: Docker Ecosystem on Azure

Devops

Page 38: Docker Ecosystem on Azure

Separation of concerns:Dave the Developer

Inside my container: my code

my libraries

my package manager

my app

my data

Page 39: Docker Ecosystem on Azure

Separation of concerns:Oscar the Ops guy

Outside the container: logging

remote access

network configuration

monitoring

Page 40: Docker Ecosystem on Azure

Docker

Components

Page 41: Docker Ecosystem on Azure

Docker: the cast

Docker Engine

Docker Hub

Docker, the community

Docker Inc, the company

Page 42: Docker Ecosystem on Azure

Docker Engine

Open Source engine to commoditize LXC

Uses copy-on-write for quick provisioning

Written in Go, runs as a daemon, comes with a CLI

Everything exposed through a REST API

Allows to build images in standard, reproducible way

Allows to share images through registries

Defines standard format for containers(stack of layers; 1 layer = tarball+metadata)

Page 43: Docker Ecosystem on Azure

… Open Source?

Nothing up the sleeve, everything on the table Public GitHub repository: https://github.com/docker/docker

Bug reports: GitHub issue tracker

Mailing lists: docker-user, docker-dev (Google groups)

IRC channels: #docker, #docker-dev (Freenode)

New features: GitHub pull requests (see CONTRIBUTING.md)

Docker Governance Advisory Board (elected by contributors)

Page 44: Docker Ecosystem on Azure

Docker Hub

•Collection of services to make Docker more useful.

Library of official base images

Public registry(push/pull your images for free)

Private registry(push/pull secret images for $)

Automated builds(link github/bitbucket repo; trigger build on commit)

More to come!

Page 45: Docker Ecosystem on Azure

Docker, the community

>700 contributors

~20 core maintainers

>40,000 Dockerized projects on GitHub

>60,000 repositories on Docker Hub

>25000 meetup members,>140 cities, >50 countries

>2,000,000 downloads of boot2docker

Page 46: Docker Ecosystem on Azure

Docker Inc, the company

Headcount: ~70

Revenue: t-shirts and stickers featuring the cool blue whale

SAAS delivered through Docker Hub

Support & Training

Page 47: Docker Ecosystem on Azure

Developing

with Docker

Page 48: Docker Ecosystem on Azure

One-time setup

On your dev env (Linux, OS X, Windows) boot2docker (25 MB VM image)

Natively (if you run Linux)

On your servers (Linux) Packages (Ubuntu, Debian, Fedora, Gentoo, Arch...)

Single binary install (Golang FTW!)

Easy provisioning on Azure, Rackspace, Digital Ocean...

Special distros: CoreOS, Project Atomic, Ubuntu Core

Page 49: Docker Ecosystem on Azure

Azure deployment

VMNAME=jpetazzoIMAGE=b39f27a8b8c64d52b05eac6a62ebad85__Ubuntu-14_04-LTS-amd64-server-20140724-en-us-30GBUSER=jpetazzoPASSWORD=1234abcdABCD@LOCATION="West US"

azure vm docker create $VMNAME \$IMAGE $USER $PASSWORD -l "$LOCATION"

export DOCKER_HOST=tcp://$VMNAME.cloudapp.net:4243docker --tls versionazure vm endpoint create $VMNAME 80

Page 50: Docker Ecosystem on Azure

Running

multiple

containers

Page 51: Docker Ecosystem on Azure
Page 52: Docker Ecosystem on Azure

Fig

Run your stack with one command: fig up

Describe your stack with one file: fig.yml

Example: Python+Redis webapp

Page 53: Docker Ecosystem on Azure

web:build: .command: python app.pyports:- "5000:5000"

volumes:- .:/code

links:- redis:redis

redis:image: redis

Page 54: Docker Ecosystem on Azure

Per-project setup

Write Dockerfiles

Write fig.yml file(s)

Test the result(i.e.: Make sure that « git clone ; fig up »works on new Docker machine works fine

Page 55: Docker Ecosystem on Azure

Per-developer setup

Make sure that they have Docker(boot2docker or other method)

git clone ; fig up

Done

Page 56: Docker Ecosystem on Azure

Development workflow

Edit code

Iterate locally or in a container(use volumes to share code between local machine and container)

When ready to test « the real thing », fig up

Page 57: Docker Ecosystem on Azure

Going to production

There are many options

full 45-minutes talk about« Docker to production »

Page 58: Docker Ecosystem on Azure

Implementing CI/CD

Each time I commit some code, I want to: build a container with that code

test that container

if the test is successful, promote that container

Page 59: Docker Ecosystem on Azure

Docker Hub to the rescue

Automated builds let you link github/bitbucket repositories to Docker Hub repositories

Each time you push to github/bitbucket: Docker Hub fetches your changes,

builds new containers images,

pushes those images to the registry.

Page 60: Docker Ecosystem on Azure

Coming next on Docker Hub...

Security notifications

Automated deployment to Docker hosts

Docker Hub Enterprise(all those features, on your infrastructure)

Page 61: Docker Ecosystem on Azure

Summary

•With Docker, I can:

put my software in containers

run those containers anywhere

write recipes to automatically build containers

use Fig to effortlessly start stacks of containers

automate testing, building, hosting of images, using the Docker Hub

Page 62: Docker Ecosystem on Azure

Advanced concepts

naming give a unique name to your containers

links connect containers together

volumes separate code and data

share data between containers

Page 63: Docker Ecosystem on Azure

Docker future

• Docker machine: provisioning hosts

• Docker swarm: clustering

• Docker compose: composing apps

• Docker plugin model: for weave, flocker

Page 64: Docker Ecosystem on Azure

Linux Container Ecosystem

Page 65: Docker Ecosystem on Azure

Weave

Page 66: Docker Ecosystem on Azure

Flocker

Page 67: Docker Ecosystem on Azure
Page 68: Docker Ecosystem on Azure

CoreOS

Page 69: Docker Ecosystem on Azure

Fleet

Page 70: Docker Ecosystem on Azure

Docker & etcd

Page 71: Docker Ecosystem on Azure

Cluster Architecture

Page 72: Docker Ecosystem on Azure
Page 73: Docker Ecosystem on Azure
Page 74: Docker Ecosystem on Azure
Page 75: Docker Ecosystem on Azure

Deis (http://deis.io)

• Open source PaaS platform that builds on CoreOS.• Replicates the popular Heroku devops workflow.

• Primary mechanism for pushing applications is through git.• Developer experience is not unlike Azure Websites…• …but is built on Linux so full support for open source stacks.

• Enables us to win migrations from Salesforce to Azure.• Hackfest in November to enable Deis for Tagboard.

• Enables us to win startups that expect this workflow.

Page 76: Docker Ecosystem on Azure
Page 77: Docker Ecosystem on Azure
Page 78: Docker Ecosystem on Azure

tpark:www$ git push deis master

• Git pushes master to deis git remote on endpoint• Deis senses static web application• Selects Heroku Buildpack• Uses buildpack to build application Docker container.• Pushes this container to a private Docker registry.• Orchestrates the creation or update of this container on

the cluster.• Updates routing mesh to route to these containers.

Page 79: Docker Ecosystem on Azure

Router Mesh

deis-1 deis-2 deis-3 deis-4

www

CoreOS CoreOS CoreOS CoreOS

Page 80: Docker Ecosystem on Azure

tpark:www$ deis scale www=3

• Deis pushes the container to two more cluster nodes.• Updates routing mesh to pass traffic to these nodes.

Page 81: Docker Ecosystem on Azure

Router Mesh

deis-1 deis-2 deis-3 deis-4

www www www

Page 82: Docker Ecosystem on Azure

tpark:api$ git push deis master

• Git pushes master to deis git remote on endpoint• Deis senses node.js application• Selects Heroku node.js Buildpack• Uses buildpack to build application Docker container.• Pushes this container to a private Docker registry.• Orchestrates the creation or update of this container on

the cluster.• Updates routing mesh to route to these containers.

Page 83: Docker Ecosystem on Azure

Router Mesh

deis-1 deis-2 deis-3 deis-4

www

api

www

api

www api

Page 84: Docker Ecosystem on Azure

Router Mesh

deis-1 deis-2 deis-3 deis-4

www

api

www

api

www api

Page 85: Docker Ecosystem on Azure

Router Mesh

deis-1 deis-2 deis-3 deis-4

www

api

www

api

www

api

Page 86: Docker Ecosystem on Azure

tpark:api$ deis config:setDATABASE_URL=postgres://user:[email protected]:5432/db

• Applications in Deis are configured through environmental variables.• MUST READ: http://12factor.net/• Key point: Code is separated from config. • Enables generic containers that are configured at runtime.• Every app container spun up by Deis will have a copy of these config

environmental variables.

Page 87: Docker Ecosystem on Azure

tpark:api$ deis logs

• Deis automatically rolls and consolidates logs from all containers.

Page 88: Docker Ecosystem on Azure

Router Mesh

deis-1 deis-2 deis-3 deis-4

www

api

www

api

www

api

Page 89: Docker Ecosystem on Azure

Router Mesh

deis-1 deis-2 deis-3 deis-4

www

api

www

api

www

api

Page 90: Docker Ecosystem on Azure
Page 91: Docker Ecosystem on Azure

Kubernetes (http://kubernetes.io)

Page 92: Docker Ecosystem on Azure

KubernetesMaster / Scheduler

host-1 host-2 host-3 host-n

…..Container

AgentContainer

AgentContainer

AgentContainer

Agent

Linux Linux Linux Linux

Page 93: Docker Ecosystem on Azure

KubernetesScheduler

host-1 host-2 host-3 host-n

…..Container

AgentContainer

AgentContainer

AgentContainer

Agent

Linux Linux Linux Linux

Container

Container

Page 94: Docker Ecosystem on Azure
Page 95: Docker Ecosystem on Azure

Kubernetes

host-1

Container

host-2 host-3 host-4 host-n

Container

Container

Container

Container

ContainerContainer

ContainerContainer

Page 96: Docker Ecosystem on Azure

Kubernetes

host-1 host-2 host-3 host-4 host-n

Frontend

Worker

my_app pod

MyAppMyApp MyApp

Replication Controller

3

Page 97: Docker Ecosystem on Azure

Kubernetes

host-1 host-2 host-3 host-4 host-n

Frontend

Worker

my_app pod

MyAppMyApp MyApp

Replication Controller

3

Page 98: Docker Ecosystem on Azure

Kubernetes

host-1 host-2 host-3 host-4 host-n

…MyAppMyApp MyApp

Replication Controller

Pod Pod

Pod

Pod

PodPod

PodPod

Replication Controller

Page 99: Docker Ecosystem on Azure

Kubernetes

host-1 host-2 host-3 host-4 host-n

…MyAppstaging

MyAppstaging

MyAppstaging

MyAppprod

MyAppprod

MyAppprod

MyAppprod

MyAppprod

MyApp Production Service{ environment: prod }

MyApp Staging Service{ environment: staging }

Labels and Services

Page 100: Docker Ecosystem on Azure
Page 101: Docker Ecosystem on Azure

• https://github.com/chanezon/azure-linux

• Docker container to get started

docker run –ti chanezon/linux

• CoreOS cluster, fleet

• Deis

• Weave

• Docker machine

• Deploy Java app

Page 102: Docker Ecosystem on Azure

• Strategic Engagement team

• We build Epic stuff with customers

• What can we do together?

• When do you want to start?

[email protected]

Page 103: Docker Ecosystem on Azure

10

3

http://www.slideshare.net/chanezon/tackling-complexity-in-giant-systems-approaches-from-several-cloud-providers

https://msopentech.com/

https://github.com/timfpark/coreos-azure

http://www.slideshare.net/jpetazzo/

http://www.slideshare.net/bcantrill/docker-and-the-future-of-containers-in-production

Page 104: Docker Ecosystem on Azure