76
Docker for Sysadmins: what's in it for me? 1 / 76

Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

  • Upload
    others

  • View
    30

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

Docker forSysadmins:what's in it

for me?1 / 76

Page 2: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

1 / 76

Who am I?Jérôme Petazzoni (@jpetazzo)

French software engineer living in California

Joined Docker (dotCloud) more than 4 years ago (I was at Docker before it was cool!)

I have built and scaled the dotCloud PaaS

I learned a few things about running containers (in production)

Started an hosting company in 2004

Sysadmin since 1999

2 / 76

Page 3: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

2 / 76

OutlineIntro / pop quizz about Docker and containers

Sysadmin point of view: VMs vs containers

Ops will be ops, devs will be devs

Composing stacks of containers

Is it safe to use it yet?

3 / 76

Page 4: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

3 / 76

Recap about Docker

and containers

4 / 76

Page 5: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

4 / 76

Build, ship, and run any app, anywhere

5 / 76

Page 6: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

5 / 76

Take any Linux program, and put it in a container

6 / 76

Page 7: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

6 / 76

Take any Linux program, and put it in a containerWeb apps and services, workers (Go, Java, Node, PHP, Python, Ruby...)

7 / 76

Page 8: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

7 / 76

Take any Linux program, and put it in a containerWeb apps and services, workers (Go, Java, Node, PHP, Python, Ruby...)

Data stores: SQL, NoSQL, big data (Cassandra, ElasticSearch, Hadoop, Mongo, MySQL, PostgreSQL, Redis...)

8 / 76

Page 9: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

8 / 76

Take any Linux program, and put it in a containerWeb apps and services, workers (Go, Java, Node, PHP, Python, Ruby...)

Data stores: SQL, NoSQL, big data (Cassandra, ElasticSearch, Hadoop, Mongo, MySQL, PostgreSQL, Redis...)

Other server-y things (Consul, Etcd, Mesos, RabbitMQ, Zookeeper...)

9 / 76

Page 10: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

9 / 76

Take any Linux program, and put it in a containerWeb apps and services, workers (Go, Java, Node, PHP, Python, Ruby...)

Data stores: SQL, NoSQL, big data (Cassandra, ElasticSearch, Hadoop, Mongo, MySQL, PostgreSQL, Redis...)

Other server-y things (Consul, Etcd, Mesos, RabbitMQ, Zookeeper...)

Command-line tools (AWS CLI, Ffmpeg...)

10 / 76

Page 11: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

10 / 76

Take any Linux program, and put it in a containerWeb apps and services, workers (Go, Java, Node, PHP, Python, Ruby...)

Data stores: SQL, NoSQL, big data (Cassandra, ElasticSearch, Hadoop, Mongo, MySQL, PostgreSQL, Redis...)

Other server-y things (Consul, Etcd, Mesos, RabbitMQ, Zookeeper...)

Command-line tools (AWS CLI, Ffmpeg...)

Desktop apps (Chrome, LibreOffice, Skype, Steam...)

11 / 76

Page 12: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

11 / 76

What about non-Linux programs?

12 / 76

Page 13: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

12 / 76

What about non-Linux programs?Desktop apps with WINE (e.g.: Spotify client)

13 / 76

Page 14: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

13 / 76

What about non-Linux programs?Desktop apps with WINE (e.g.: Spotify client)

Coming soon: Docker for Windows (run Windows apps on Windows machines)

14 / 76

Page 15: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

14 / 76

What about non-Linux programs?Desktop apps with WINE (e.g.: Spotify client)

Coming soon: Docker for Windows (run Windows apps on Windows machines)

Coming soon: Docker for FreeBSD (port in progress)

15 / 76

Page 16: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

15 / 76

What about non-Linux programs?Desktop apps with WINE (e.g.: Spotify client)

Coming soon: Docker for Windows (run Windows apps on Windows machines)

Coming soon: Docker for FreeBSD (port in progress)

Coming eventually: Docker for OS X (technically possible; but is this useful?)

16 / 76

Page 17: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

16 / 76

Ship that container easily and efficientlyDocker comes with an image distribution protocol

Distribution server can be hosted by Docker Inc. (free for public images)

Distribution protocol is public

Open source reference implementation (used by Docker Inc. for the public registry)

Container images are broken down into layers

When updating and distributing an image, only ship relevant layers

17 / 76

Page 18: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

17 / 76

Run those containers anywhereContainers can run in VMs or in physical machines

Docker is available on all modern Linux variants

Many IAAS providers have server images with Docker

On OS X and Windows dev machines: boot2docker

There are distros dedicated to run Docker containers (Atomic, CoreOS, RancherOS, Snappy Core...)

Other Docker implementations exist (e.g. Joyent Triton)

Docker-as-a-Service providers are blooming

18 / 76

Page 19: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

18 / 76

Blah, blah, blah ...

19 / 76

Page 20: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

19 / 76

We already have zones, LXC, jails!

20 / 76

Page 21: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

20 / 76

We already have zones, LXC, jails!Give me a one-liner to start an Ubuntu 12.04 LTS with zones/LXC/jails

21 / 76

Page 22: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

21 / 76

We already have zones, LXC, jails!Give me a one-liner to start an Ubuntu 12.04 LTS with zones/LXC/jails

You know how to do this, but your developers don't (and they don't want to learn, that's not their job)

22 / 76

Page 23: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

22 / 76

We already have zones, LXC, jails!Give me a one-liner to start an Ubuntu 12.04 LTS with zones/LXC/jails

You know how to do this, but your developers don't (and they don't want to learn, that's not their job)

docker run -ti ubuntu:12.04 bash

23 / 76

Page 24: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

23 / 76

We already have zones, LXC, jails!Give me a one-liner to start an Ubuntu 12.04 LTS with zones/LXC/jails

You know how to do this, but your developers don't (and they don't want to learn, that's not their job)

docker run -ti ubuntu:12.04 bash

Why do you use dpkg/rpm/apt/yum instead offtp+configure+make install?

24 / 76

Page 25: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

24 / 76

We already have zones, LXC, jails!Give me a one-liner to start an Ubuntu 12.04 LTS with zones/LXC/jails

You know how to do this, but your developers don't (and they don't want to learn, that's not their job)

docker run -ti ubuntu:12.04 bash

Why do you use dpkg/rpm/apt/yum instead offtp+configure+make install?

Because you're not paid to compile things by hand

25 / 76

Page 26: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

25 / 76

We already have zones, LXC, jails!Give me a one-liner to start an Ubuntu 12.04 LTS with zones/LXC/jails

You know how to do this, but your developers don't (and they don't want to learn, that's not their job)

docker run -ti ubuntu:12.04 bash

Why do you use dpkg/rpm/apt/yum instead offtp+configure+make install?

Because you're not paid to compile things by hand

Guess what: you're not paid to provision environments by hand

26 / 76

Page 27: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

26 / 76

"Give a man a fish, you feed him for a day; teach a man to fish..."

27 / 76

Page 28: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

27 / 76

VMs vscontainers

28 / 76

Page 29: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

28 / 76

PortabilityContainers can run on top of public cloud (run the same container image everywhere)

Nested hypervisors (VMs in VMs) exist, but still rare

Containers are easy to move (thanks to layers, distribution protocol, registry...)

VM images have to be converted and transferred (both are slow operations)

29 / 76

Page 30: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

29 / 76

Format & environmentVM

executes machine codeenvironment = something that looks like a computer

JVM

executes JVM bytecodeenvironment = Java APIs

Container

executes machine codeenvironment = Linux kernel system calls interface

30 / 76

Page 31: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

30 / 76

Containers have low overheadNormal* process(es) running on top of normal kernel

No device emulation (no extra code path involved in I/O)

Context switch between containers = context switch between processes

Benchmarks show no difference at all between containers and bare metal (after adequate tuning and options have been selected)

Containers have higher density

* There are extra "labels" denoting membership to given namespaces and control groups. Similar to regular UID.

31 / 76

Page 32: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

31 / 76

VMs have stronger isolationInter-VM communication must happen over the network (Some hypervisors have custom paths, but non-standard)

VMs can run as non-privileged processes on the host (Breaking out of a VM will have ~zero security impact)

Containers run on top of a single kernel (Kernel vulnerability can lead to full scale compromise)

Containers can share files, sockets, FIFOs, memory areas... (They can communicate with standard UNIX mechanisms)

32 / 76

Page 33: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

32 / 76

Analogy: brick walls vs. room dividersBrick walls

sturdy

slow to build

messy to move

Room dividers

fragile

deployed in seconds

moved easily

33 / 76

Page 34: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

33 / 76

Blurring linesIntel Clear Containers; Clever Cloud (stripped down VMs, boot super fast, tiny footprint)

Joyent Triton (Solaris "branded zones," running Linux binaries securely,exposing the Docker API)

Ongoing efforts to harden containers (GRSEC, SELinux, AppArmor)

34 / 76

Page 35: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

34 / 76

VMs vscontainers

(hoster/opsperspective)

35 / 76

Page 36: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

35 / 76

InsideVMs need a full OS and associated tools (Backups, logging, periodic job execution, remote access...)

Containers can go both ways:

machine container (runs init, cron, ssh, syslog ... and the app)

application container (runs the app and nothing else; relies on external mechanisms)

36 / 76

Page 37: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

36 / 76

VM lifecycleOption 1: long lifecycle (provisioning→update→update→…→update→disposal)

easily leads to configuration drift (subtle differences that add up over time)

requires tight configuration management

Option 2: golden images (phoenix servers, immutable infrastructure ...)

create new image for each modification

deploy by replacing old servers with new servers

nice and clean, but heavy and complex to setup

37 / 76

Page 38: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

37 / 76

Container lifecycleContainers are created from an image

Image creation is easy

Image upgrade is fast

Immutable infrastructure is easy to implement

Why? Because container snapshots are extremely fast and cheap.

38 / 76

Page 39: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

38 / 76

Development process (VMs)Best practice in production = 1 VM per component

Not realistic to have 1 VM per component in dev

Also: prod has additional/different components (e.g.: logging, monitoring, service discovery...)

Result: very different environment for dev & prod

39 / 76

Page 40: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

39 / 76

Development process (containers)Run tons of containers on dev machines

Build the same container for dev & prod

How do we provide container variants?

40 / 76

Page 41: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

40 / 76

Bloated containersContainers have all the software required for production

In dev mode, only essential processes are started

In prod mode, additional processes run as well

Problems:

bigger containers

behavior can differ (because of extra processes)

extra processes duplicated between containers

hard to test those extra processes in isolation

41 / 76

Page 42: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

41 / 76

Separation ofconcerns

(let ops do ops, and devs do dev)

42 / 76

Page 43: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

42 / 76

Principle"Do one thing, do it well"

One container for the component itself

One container for logging

One container for monitoring

One container for backups

One container for debugging (when needed)

etc.

43 / 76

Page 44: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

43 / 76

Implementation (general principles)Containers can share almost anything, selectively

files (logs, data at rest, audit)

network stack (traffic routing and analysis, monitoring)

process space, memory (process tracing and debugging)

44 / 76

Page 45: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

44 / 76

Let's dive into the details

45 / 76

Page 46: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

45 / 76

Logging (option 1: Docker logging drivers)Containers write to standard output

Docker has different logging drivers:

writes to local JSON files by default

can send to syslog

Imperfect solution for now, but will be improved. Preferred in the long run.

46 / 76

Page 47: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

46 / 76

Logging (option 2: shared log directory)Containers write regular files to a directory

That directory is shared with another container

docker run -d --name myapp1 -v /var/log myapp:v1.0

In development setup:

docker run --volumes-from myapp1 ubuntu \ sh -c 'tail -F /var/log/*'

In production:

docker run -d --volumes-from myapp1 logcollector

47 / 76

Page 48: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

47 / 76

Logging takeawaysApplication can be "dumb" about logging

Log collection and shipping happens in Docker, or in separate(s) container(s)

Run custom log analyzer without changing app container (e.g. apachetop)

Migrate logging system without changing app container

48 / 76

Page 49: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

48 / 76

"Yes, but...""What about performance overhead?"

no performance overhead

both containers access files directly (just like processes running on the same machine)

"What about synchronization issues?"

same as previous answer!

49 / 76

Page 50: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

49 / 76

Backups (file-based)Store mutable data on Docker volumes (same mechanism as for logs)

Share volumes with special-purpose backup containers

Put backup tools in the backup container (boto, rsync, s3cmd, unison...)

docker run --volumes-from mydb1 ubuntu \ rsync -av /var/lib/ backup@remotehost:mydb1/

The whole setup doesn't touch the app (or DB) container

50 / 76

Page 51: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

50 / 76

Backups (network-based)Run the backup job (pg_dump, mysqldump, etc.) from a separate container

Advantages (vs. running in the same container):

nothing to install in the app (or DB) container

if the backup job runs amok, it remains contained (!)

another team can maintain backup jobs (and be responsible for them)

51 / 76

Page 52: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

51 / 76

Network analysisPacket capture (tcpdump, ngrep, ntop, etc.)

Low-level metrics (netstat, ss, etc.)

Install required tools in a separate container image

Run a container in the same network namespace

docker run -d --name web1 nginxdocker run -ti --net container:web1 tcpdump -pni eth0docker run -ti --net container:web1 ubuntu ss -n --tcp

52 / 76

Page 53: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

52 / 76

Service discoveryDocker can do linking and generic DNS injection

Your code connects to e.g. redis (pretending that redis resolves to something)

Docker adds a DNS alias* so that redis resolves to the right container, or to some external service

In dev, Docker Compose manages service dependencies

In prod, you abstract service discovery from the container

* Really, an entry in the container's /etc/hosts.

53 / 76

Page 54: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

53 / 76

Service discovery in practiceWhen service A needs to talk to service B...

1. Start container B on a Docker host

54 / 76

Page 55: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

54 / 76

Service discovery in practiceWhen service A needs to talk to service B...

1. Start container B on a Docker host

2. Retrieve host+port allocated for B

55 / 76

Page 56: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

55 / 76

Service discovery in practiceWhen service A needs to talk to service B...

1. Start container B on a Docker host

2. Retrieve host+port allocated for B

3. Start ambassador (relaying to this host+port)

56 / 76

Page 57: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

56 / 76

Service discovery in practiceWhen service A needs to talk to service B...

1. Start container B on a Docker host

2. Retrieve host+port allocated for B

3. Start ambassador (relaying to this host+port)

4. Start container A linked to ambassador

57 / 76

Page 58: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

57 / 76

Service discovery in practiceWhen service A needs to talk to service B...

1. Start container B on a Docker host

2. Retrieve host+port allocated for B

3. Start ambassador (relaying to this host+port)

4. Start container A linked to ambassador

5. Profit!

58 / 76

Page 59: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

58 / 76

General patternYour code runs in the same container in dev and prod

Add "sidekick*" containers for additional tasks

Developers don't have to be bothered about ops

Ops can do their job without messing with devs' code

* Kubernetes sometimes calls them "sidecars."

59 / 76

Page 60: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

59 / 76

Composingstacks of

containers

60 / 76

Page 61: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

60 / 76

Docker Compose

61 / 76

Page 62: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

61 / 76

docker-compose.ymlrng: build: rng

hasher: build: hasher

webui: build: webui links: - redis ports: - "80:80" volumes: - "webui/files/:/files/"

redis: image: redis

worker: build: worker links: - rng - hasher - redis

62 / 76

Page 63: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

62 / 76

Docker ComposeStart whole stack with docker-compose up

Start individual containers (and their dependencies) with docker-compose up xyz

Takes care of container lifecycle (creation, update, data persistence, scaling up/down...)

Doesn't automatically solve networking and discovery (yet)

63 / 76

Page 64: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

63 / 76

Docker ComposeStart whole stack with docker-compose up

Start individual containers (and their dependencies) with docker-compose up xyz

Takes care of container lifecycle (creation, update, data persistence, scaling up/down...)

Doesn't automatically solve networking and discovery (yet)

... However ...

64 / 76

Page 65: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

64 / 76

docker-compose.yml, reloaded

hasher: build: hasher

worker: build: worker links: - rng - hasherproxy:hasher - redis

hasherproxy: image: jpetazzo/hamba links: - hasher command: 80 hasher 80

(This was automatically generated by a tiny Python script.)

65 / 76

Page 66: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

65 / 76

Heads up!Docker networking is evolving quickly

Docker 1.7 has hooks to support:

"networks" as first class objects

multiple networks

overlay driver allowing to span networks acrossmultiple hosts

networking plugins from ecosystem partners

66 / 76

Page 67: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

66 / 76

Conclusions

67 / 76

Page 68: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

67 / 76

ConclusionsContainers can share more context than VMs

We can use this to decouple complexity (think "microservices" but for ops/devs separation)

All tasks typically requiring VM access can be done in separate containers

As a result, deployments are broken down in smaller, simpler pieces

Complex stacks are expressed with simple YAML files

Docker isn't a "silver bullet" to solve all problems, but it gives us tools that make our jobs easier

68 / 76

Page 69: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

68 / 76

"But it's not production ready!"

69 / 76

Page 70: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

69 / 76

Docker is just two years old

70 / 76

Page 71: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

70 / 76

Docker is just two years oldAnd yet ...

71 / 76

Page 72: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

71 / 76

Docker is just two years oldAnd yet ...

Activision, Baidu, BBC News, Booz Allen Hamilton, CapitalOne, Disney, Dramafever, Dreamworks, General Electrics,Gilt, Grub Hub, Heroku, Iron.io, Lyft, Netflix, New YorkTimes, New Relic, Orbitz, Paypal, Rackspace, Riot Games,Shippable, Shopify, Spotify, Stack Exchange, Uber,VMware, Yandex, Yelp, ...

72 / 76

Page 73: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

72 / 76

Docker is just two years oldAnd yet ...

Activision, Baidu, BBC News, Booz Allen Hamilton, CapitalOne, Disney, Dramafever, Dreamworks, General Electrics,Gilt, Grub Hub, Heroku, Iron.io, Lyft, Netflix, New YorkTimes, New Relic, Orbitz, Paypal, Rackspace, Riot Games,Shippable, Shopify, Spotify, Stack Exchange, Uber,VMware, Yandex, Yelp, ...

Reminder: it took 3 years for Linux to get to 1.0 (1991 to 1994) and 7 years to get support for big vendors

73 / 76

Page 74: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

73 / 76

What are they using Docker for?Serving production traffic

Rapid onboarding of new developers

CI/CD

Packaging applications for their customers

etc.

74 / 76

Page 75: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

74 / 76

What are they using Docker for?Serving production traffic

Rapid onboarding of new developers

CI/CD

Packaging applications for their customers

etc.

When you have generic questions about Docker, try to s/docker/virtualization/ and ask again...

75 / 76

Page 76: Docker for Sysadmins: what's in it for me? - RMLL · Docker for Sysadmins: what's in it for me? 1 1 Who am I? ... (used by Docker Inc. for the public registry) Container images are

75 / 76

Thanks! Questions?

@jpetazzo @docker

76 / 76