all things open 2015: docker: everything you should know

35
Docker: Everything you should know 1 / 35

Upload: docker-inc

Post on 15-Apr-2017

372 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: All Things Open 2015: DOCKER: EVERYTHING YOU SHOULD KNOW

Docker: Everything you

should know

1 / 35

Page 2: All Things Open 2015: DOCKER: EVERYTHING YOU SHOULD KNOW

Who am I?Aaron Huslage (@huslage)

Sysadmin since 1993

Since April 2014: Solution Engineer @ Docker

2 / 35

Page 3: All Things Open 2015: DOCKER: EVERYTHING YOU SHOULD KNOW

OutlineWhy Docker?

What's Docker?

How to get started?

3 / 35

Page 4: All Things Open 2015: DOCKER: EVERYTHING YOU SHOULD KNOW

Why Docker?

4 / 35

Page 5: All Things Open 2015: DOCKER: EVERYTHING YOU SHOULD KNOW

Why Docker?Faster application development cycle

Multiplication of environments

Scaling requirements

5 / 35

Page 6: All Things Open 2015: DOCKER: EVERYTHING YOU SHOULD KNOW

Yesterday: slow cycles (months/years)Specification

Implementation

Validation

Release

Maintenance

6 / 35

Page 7: All Things Open 2015: DOCKER: EVERYTHING YOU SHOULD KNOW

Today: fast cycles (weeks/days)Minimum Viable Product

Short iterations (sprints)

Continuous Deployment

A project is never "done" or "over"

Agile methods

7 / 35

Page 8: All Things Open 2015: DOCKER: EVERYTHING YOU SHOULD KNOW

Yesterday: single environmentOne language

One framework

One database

One server (+ sometimes a dev environment)

8 / 35

Page 9: All Things Open 2015: DOCKER: EVERYTHING YOU SHOULD KNOW

Today: many environmentsMany languages

Polyglot platforms

Simultaneous use of SQL, NoSQL ...

The right tool for the right job

Many servers (everybody has their local dev env; there are many envs for testing, CI, QA, etc.)

9 / 35

Page 10: All Things Open 2015: DOCKER: EVERYTHING YOU SHOULD KNOW

Yesterday: slow, vertical deploymentNew versions once in a while

Installed to few servers (sometimes just one)

Scaling = scaling up (you're gonna need a bigger server)

Scaling must be planned far ahead

10 / 35

Page 11: All Things Open 2015: DOCKER: EVERYTHING YOU SHOULD KNOW

Today: rapid, horizontal deploymentNew versions all the time (every week / day / hour)

Installed to many servers

Scaling = scaling out (MOAR servers!)

Need to be able to scale quickly

11 / 35

Page 12: All Things Open 2015: DOCKER: EVERYTHING YOU SHOULD KNOW

What is Docker?

12 / 35

Page 13: All Things Open 2015: DOCKER: EVERYTHING YOU SHOULD KNOW

What is Docker?Container execution engine

Container build system

Container image distribution

Ginormous ecosystem

13 / 35

Page 14: All Things Open 2015: DOCKER: EVERYTHING YOU SHOULD KNOW

Container execution engine~Hypervisor for containers

Container =~ lightweight virtual machine

... What is a container???

14 / 35

Page 15: All Things Open 2015: DOCKER: EVERYTHING YOU SHOULD KNOW

15 / 35

Page 16: All Things Open 2015: DOCKER: EVERYTHING YOU SHOULD KNOW

ContainerIt looks and feels like a VM

Standard UNIX processes, isolated by kernel mechanisms:

namespaces

cgroups (control groups)

copy-on-write

Insanely fast boot times

Insanely low resource usage

16 / 35

Page 17: All Things Open 2015: DOCKER: EVERYTHING YOU SHOULD KNOW

Build systemDockerfile = recipe describing the build process

Easy to learn (similar to shell scripting)

Fast (caching system)

Reliable, reproducible

17 / 35

Page 18: All Things Open 2015: DOCKER: EVERYTHING YOU SHOULD KNOW

Build systemDockerfile = recipe describing the build process

Easy to learn (similar to shell scripting)

Fast (caching system)

Reliable, reproducible

Let's have our cake - and eat it too

(Compared to classic scripting, or configuration management systems like Puppet, Chef, Salt, Ansible...)

18 / 35

Page 19: All Things Open 2015: DOCKER: EVERYTHING YOU SHOULD KNOW

19 / 35

Page 20: All Things Open 2015: DOCKER: EVERYTHING YOU SHOULD KNOW

Image formatProblem: VM images are big

Solution 1: container images are smaller

doesn't need hardware support, kernel, drivers ...

separate handling of logs, metrics, backups ...

Solution 2: images broken down into layers

1 layer = 1 build step

example: base system, packages, code, config

only transfer updated layers

20 / 35

Page 21: All Things Open 2015: DOCKER: EVERYTHING YOU SHOULD KNOW

Distribution protocolProblem: it's both too simple and too complicated

"just do tar or rsync ...

21 / 35

Page 22: All Things Open 2015: DOCKER: EVERYTHING YOU SHOULD KNOW

Distribution protocolProblem: it's both too simple and too complicated

"just do tar or rsync ...

... with these 5 cryptic options, and it works"

22 / 35

Page 23: All Things Open 2015: DOCKER: EVERYTHING YOU SHOULD KNOW

Distribution protocolProblem: it's both too simple and too complicated

"just do tar or rsync ...

... with these 5 cryptic options, and it works"

(mostly)

23 / 35

Page 24: All Things Open 2015: DOCKER: EVERYTHING YOU SHOULD KNOW

Distribution protocolProblem: it's both too simple and too complicated

"just do tar or rsync ...

... with these 5 cryptic options, and it works"

(mostly)

Solution: Docker Registry

transfer layers via an open REST API

open source reference implementation

free service for public images (à la GitHub)

24 / 35

Page 25: All Things Open 2015: DOCKER: EVERYTHING YOU SHOULD KNOW

25 / 35

Page 26: All Things Open 2015: DOCKER: EVERYTHING YOU SHOULD KNOW

Ecosystem: images~100 official images

Linux distros (Debian, Ubuntu, CentOS, Fedora, ...)

components (MySQL, Redis, PostgreSQL, MongoDB, NGINX...)

languages (Python, Ruby, Java, Go, Node...)

applications (Wordpress...)

~150,000 contributed images

26 / 35

Page 27: All Things Open 2015: DOCKER: EVERYTHING YOU SHOULD KNOW

Ecosystem: code~100,000 GitHub repositories have a Dockerfile

~1000 contributors to Docker code

Thousands of projects integrating with Docker

Some official tools:

Machine (deploy Docker hosts)Compose (manage multi-container applications)Swarm (cluster multiple Docker hosts together)

27 / 35

Page 28: All Things Open 2015: DOCKER: EVERYTHING YOU SHOULD KNOW

One example: Docker ComposeAssemble application from multiple containers

Define parameters of each container

how to build it

how to run it (command, arguments, environment...)

network port mappings

linking between containers

28 / 35

Page 29: All Things Open 2015: DOCKER: EVERYTHING YOU SHOULD KNOW

29 / 35

Page 30: All Things Open 2015: DOCKER: EVERYTHING YOU SHOULD KNOW

How to getstarted?

30 / 35

Page 31: All Things Open 2015: DOCKER: EVERYTHING YOU SHOULD KNOW

If you're in a hurryOS X, Windows: Docker Toolbox + boot2docker

tiny VM image (less than 30 MB)

works on (most) physical and virtual machines

Linux: get.docker.com

shell script

usable with Cloud Init or |sh*

* Make sure you use https and nobody gets hurt!

31 / 35

Page 32: All Things Open 2015: DOCKER: EVERYTHING YOU SHOULD KNOW

If you like readingdocs.docker.com

start with "get started" (duh!) (it's written in good old "howto" style)

reference documentations

32 / 35

Page 33: All Things Open 2015: DOCKER: EVERYTHING YOU SHOULD KNOW

If you like looking at / listening totraining.docker.com

Free, official training videos

Intro to Docker (general concepts)

Docker Fundamentals (first steps with Docker)

Docker Operations (using Machine, Swarm, Compose)

33 / 35

Page 34: All Things Open 2015: DOCKER: EVERYTHING YOU SHOULD KNOW

How to "Dockerize" my app?1. Write a Dockerfile for the main component

2. Write a docker-compose.yml for the app itself

3. Use Docker+Compose during development

4. Use Docker+Compose for testing/QA/acceptance...

5. (Optionally) setup CI/CD

6. Go to production with Docker+Compose (static resource scheduling)

If you have 100s of apps with 100s of containers (each): setup a self-service container platform for your developers (using e.g. Swarm, Mesos, Kubernetes...)

34 / 35

Page 35: All Things Open 2015: DOCKER: EVERYTHING YOU SHOULD KNOW

Questions?

@huslage @docker

35 / 35