all things open 2015: docker: everything you should know

Post on 15-Apr-2017

371 Views

Category:

Technology

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Docker: Everything you

should know

1 / 35

Who am I?Aaron Huslage (@huslage)

Sysadmin since 1993

Since April 2014: Solution Engineer @ Docker

2 / 35

OutlineWhy Docker?

What's Docker?

How to get started?

3 / 35

Why Docker?

4 / 35

Why Docker?Faster application development cycle

Multiplication of environments

Scaling requirements

5 / 35

Yesterday: slow cycles (months/years)Specification

Implementation

Validation

Release

Maintenance

6 / 35

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

Short iterations (sprints)

Continuous Deployment

A project is never "done" or "over"

Agile methods

7 / 35

Yesterday: single environmentOne language

One framework

One database

One server (+ sometimes a dev environment)

8 / 35

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

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

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

What is Docker?

12 / 35

What is Docker?Container execution engine

Container build system

Container image distribution

Ginormous ecosystem

13 / 35

Container execution engine~Hypervisor for containers

Container =~ lightweight virtual machine

... What is a container???

14 / 35

15 / 35

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

Build systemDockerfile = recipe describing the build process

Easy to learn (similar to shell scripting)

Fast (caching system)

Reliable, reproducible

17 / 35

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

19 / 35

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

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

"just do tar or rsync ...

21 / 35

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

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

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

25 / 35

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

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

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

29 / 35

How to getstarted?

30 / 35

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

If you like readingdocs.docker.com

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

reference documentations

32 / 35

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

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

Questions?

@huslage @docker

35 / 35

top related