dockerize it: stop living in the past and embrace the future

121
Dockerize it! Alex nadalin - NAMSHI.com

Upload: codemotion

Post on 11-Apr-2017

174 views

Category:

Software


2 download

TRANSCRIPT

Page 1: Dockerize it: stop living in the past and embrace the future

Dockerize it!Alex nadalin - NAMSHI.com

Page 2: Dockerize it: stop living in the past and embrace the future
Page 3: Dockerize it: stop living in the past and embrace the future
Page 4: Dockerize it: stop living in the past and embrace the future

WARNING

Page 5: Dockerize it: stop living in the past and embrace the future

MINIMALDOCKERAHEAD

Page 6: Dockerize it: stop living in the past and embrace the future

playing with containers

Page 7: Dockerize it: stop living in the past and embrace the future

figuring them out

Page 8: Dockerize it: stop living in the past and embrace the future

never tried

Page 9: Dockerize it: stop living in the past and embrace the future

DEMO

Page 10: Dockerize it: stop living in the past and embrace the future

Container laws

Page 11: Dockerize it: stop living in the past and embrace the future

Why containers?

Page 12: Dockerize it: stop living in the past and embrace the future

remember when...

Page 13: Dockerize it: stop living in the past and embrace the future

require(‘http’).createServer(...)

Page 14: Dockerize it: stop living in the past and embrace the future

<li ng-repeat=”item in items” … >

Page 15: Dockerize it: stop living in the past and embrace the future

go func()

Page 16: Dockerize it: stop living in the past and embrace the future

or when...

Page 17: Dockerize it: stop living in the past and embrace the future

sudo service nginx restart

Page 18: Dockerize it: stop living in the past and embrace the future

apt-get install curl

Page 19: Dockerize it: stop living in the past and embrace the future

ulimit -n 1025

Page 20: Dockerize it: stop living in the past and embrace the future

Systems are

boring.

Page 21: Dockerize it: stop living in the past and embrace the future

Systems aref*****gboring.

Page 22: Dockerize it: stop living in the past and embrace the future

Code is an F1 pilot

Page 23: Dockerize it: stop living in the past and embrace the future

unique style

Page 24: Dockerize it: stop living in the past and embrace the future

hard to replicatehard to replicate

hard to replicatehard to replicate

hard to replicate

Page 25: Dockerize it: stop living in the past and embrace the future

System is the F1 car

Page 26: Dockerize it: stop living in the past and embrace the future

Robust

Page 27: Dockerize it: stop living in the past and embrace the future

Reliable

Page 28: Dockerize it: stop living in the past and embrace the future

Replicable

Page 29: Dockerize it: stop living in the past and embrace the future
Page 30: Dockerize it: stop living in the past and embrace the future

Systems aren’tnice to build

Page 31: Dockerize it: stop living in the past and embrace the future

They are niceto orchestrate

Page 32: Dockerize it: stop living in the past and embrace the future
Page 33: Dockerize it: stop living in the past and embrace the future

VMs

Page 34: Dockerize it: stop living in the past and embrace the future

How do theydiffer fromcontainers?

Page 35: Dockerize it: stop living in the past and embrace the future

“it’s just like a VM,just much more lightweight”

Page 36: Dockerize it: stop living in the past and embrace the future

“it’s just like a VM,just much more lightweight”FLUFF

Page 37: Dockerize it: stop living in the past and embrace the future

kernel

Page 38: Dockerize it: stop living in the past and embrace the future

resources

Page 39: Dockerize it: stop living in the past and embrace the future

isolation

Page 40: Dockerize it: stop living in the past and embrace the future

security

Page 41: Dockerize it: stop living in the past and embrace the future

“Containers have similar resourceisolation and allocation benefits as

virtual machines but a differentarchitectural approach allows them

to be much more portable and efficient”

https://www.docker.com/what-docker

Page 42: Dockerize it: stop living in the past and embrace the future

Law #1

Even though they might try to solve similar problems, containers and VMs are fundamentally different

Page 43: Dockerize it: stop living in the past and embrace the future

1996

Page 44: Dockerize it: stop living in the past and embrace the future
Page 45: Dockerize it: stop living in the past and embrace the future
Page 46: Dockerize it: stop living in the past and embrace the future
Page 47: Dockerize it: stop living in the past and embrace the future
Page 48: Dockerize it: stop living in the past and embrace the future

https://github.com/docker/libcontainer/blob/master/PRINCIPLES.md

Page 49: Dockerize it: stop living in the past and embrace the future

runC

Page 50: Dockerize it: stop living in the past and embrace the future

Law #2

Docker is not here to stay(at least in the way wethink of it nowadays)

Page 51: Dockerize it: stop living in the past and embrace the future

Think thatDocker is simple

Page 53: Dockerize it: stop living in the past and embrace the future

Think thatDocker is simple

Page 54: Dockerize it: stop living in the past and embrace the future

# docker-compose.ymlservices: web: build: . ports: - "8080:8080"

volumes: - .:/src

$ docker-compose up

Page 55: Dockerize it: stop living in the past and embrace the future

expand the horizon

Page 57: Dockerize it: stop living in the past and embrace the future
Page 58: Dockerize it: stop living in the past and embrace the future

We have Docker in oursystem

Page 59: Dockerize it: stop living in the past and embrace the future

We’re developinga nodejs app

Page 60: Dockerize it: stop living in the past and embrace the future

without nodejs

Page 61: Dockerize it: stop living in the past and embrace the future

we’re exposing it fromour container to our host

(-p 8080:8080)

Page 62: Dockerize it: stop living in the past and embrace the future

then we’re running ngrokto expose our host

to the internet

Page 63: Dockerize it: stop living in the past and embrace the future

without ngrok

Page 64: Dockerize it: stop living in the past and embrace the future
Page 65: Dockerize it: stop living in the past and embrace the future

Law #3

Containers aren’t suitable for dev or production, containers are

suitable for use-cases

Page 66: Dockerize it: stop living in the past and embrace the future
Page 67: Dockerize it: stop living in the past and embrace the future
Page 68: Dockerize it: stop living in the past and embrace the future
Page 69: Dockerize it: stop living in the past and embrace the future
Page 70: Dockerize it: stop living in the past and embrace the future
Page 71: Dockerize it: stop living in the past and embrace the future
Page 72: Dockerize it: stop living in the past and embrace the future
Page 73: Dockerize it: stop living in the past and embrace the future
Page 74: Dockerize it: stop living in the past and embrace the future
Page 75: Dockerize it: stop living in the past and embrace the future
Page 76: Dockerize it: stop living in the past and embrace the future

docker pull graylog2/allinone

Page 77: Dockerize it: stop living in the past and embrace the future

Law #4

Dockerfiles are the simplest form of configuration management

Page 78: Dockerize it: stop living in the past and embrace the future

Orchestratingcontainers isn’t

simple.

Page 79: Dockerize it: stop living in the past and embrace the future

But it’s thefun part :-)

Page 80: Dockerize it: stop living in the past and embrace the future
Page 81: Dockerize it: stop living in the past and embrace the future

apiVersion: v1kind: ReplicationControllermetadata: name: app labels: name: appspec: replicas: 1 selector: name: app template: metadata: labels: name: app spec: containers: - name: master image: my-nodejs-app ports: - containerPort: 1234

Page 82: Dockerize it: stop living in the past and embrace the future

apiVersion: v1kind: ReplicationControllermetadata: name: app labels: name: appspec: replicas: 1 selector: name: app template: metadata: labels: name: app spec: containers: - name: master image: my-nodejs-app ports: - containerPort: 1234

Page 83: Dockerize it: stop living in the past and embrace the future

kubectl create -f/path/to/definition.yml

Page 84: Dockerize it: stop living in the past and embrace the future

PODs

REPLICATION CONTROLLERS

SERVICES

Page 85: Dockerize it: stop living in the past and embrace the future

PODs

REPLICATION CONTROLLERS

SERVICES

Page 86: Dockerize it: stop living in the past and embrace the future

A set of logically linked containers

Page 87: Dockerize it: stop living in the past and embrace the future
Page 88: Dockerize it: stop living in the past and embrace the future

PODs

REPLICATION CONTROLLERS

SERVICES

Page 89: Dockerize it: stop living in the past and embrace the future

The guy who makes surePODs are up & running

Page 90: Dockerize it: stop living in the past and embrace the future
Page 91: Dockerize it: stop living in the past and embrace the future

apiVersion: v1kind: ReplicationControllermetadata: name: app labels: name: appspec: replicas: 1 selector: name: app template: metadata: labels: name: app spec: containers: - name: master image: my-nodejs-app ports: - containerPort: 1234

Page 92: Dockerize it: stop living in the past and embrace the future

kubectl scale--replicas=2 rc app

Page 93: Dockerize it: stop living in the past and embrace the future
Page 94: Dockerize it: stop living in the past and embrace the future

PODs

REPLICATION CONTROLLERS

SERVICES

Page 95: Dockerize it: stop living in the past and embrace the future
Page 96: Dockerize it: stop living in the past and embrace the future
Page 97: Dockerize it: stop living in the past and embrace the future
Page 98: Dockerize it: stop living in the past and embrace the future
Page 99: Dockerize it: stop living in the past and embrace the future
Page 100: Dockerize it: stop living in the past and embrace the future
Page 101: Dockerize it: stop living in the past and embrace the future

The DataCenter of thefuture is taking shape

Page 102: Dockerize it: stop living in the past and embrace the future

Law #5

Configuration management is (almost) dead

Long live orchestrators

Page 103: Dockerize it: stop living in the past and embrace the future
Page 104: Dockerize it: stop living in the past and embrace the future

Law #6

Talk services, not machines

Page 105: Dockerize it: stop living in the past and embrace the future

NERD ADVICEContainers aren’tbetter than VMs, it really just depends on what you need to dohttps://goo.gl/DGQKDA

Page 106: Dockerize it: stop living in the past and embrace the future

NERD ADVICEForget about the hosts, go GCE if you canhttps://goo.gl/haanq4

Page 107: Dockerize it: stop living in the past and embrace the future

NERD ADVICEElse, use a mature orchestration platformhttp://kubernetes.io/ https://goo.gl/sbk3Hk (swarm) http://mesos.apache.org/

Page 108: Dockerize it: stop living in the past and embrace the future

NERD ADVICERun your hosts on safe, light OSlike CoreOShttps://coreos.com/

Page 109: Dockerize it: stop living in the past and embrace the future

NERD ADVICEUse Alpine for your containers,it’s a minimal security-orientedLinux distrohttp://goo.gl/MF4nKp

Page 110: Dockerize it: stop living in the past and embrace the future

NERD ADVICEAvoid runningcontainers asroothttp://goo.gl/MF4nKp

Page 111: Dockerize it: stop living in the past and embrace the future

NERD ADVICERegularly scanyour clusters tosee if there’s anysecurity gotchahttps://goo.gl/l8tO31

Page 112: Dockerize it: stop living in the past and embrace the future

NERD ADVICEIsolate “colanders” like jenkins in containershttps://goo.gl/1HuQjV

Page 113: Dockerize it: stop living in the past and embrace the future

NERD ADVICEStop manually installing software on your own machinehttps://goo.gl/9fHWHU

Page 114: Dockerize it: stop living in the past and embrace the future

NERD ADVICELive like it’s 2016https://goo.gl/2FNwGqhttps://github.com/coreos/rkthttps://runc.io/

Page 115: Dockerize it: stop living in the past and embrace the future

Alessandro Nadalin

Page 116: Dockerize it: stop living in the past and embrace the future

Alessandro Nadalin

@_odino_

Page 117: Dockerize it: stop living in the past and embrace the future

Alessandro Nadalin

@_odino_

Namshi

Page 118: Dockerize it: stop living in the past and embrace the future

Alessandro Nadalin

@_odino_

Namshi

VP Technology

Page 119: Dockerize it: stop living in the past and embrace the future

Alessandro Nadalin

@_odino_

Namshi

VP Technology

odino.org

Page 120: Dockerize it: stop living in the past and embrace the future

Thanks!Alessandro Nadalin

@_odino_

Namshi

VP Technology

odino.org

Page 121: Dockerize it: stop living in the past and embrace the future

we are hiring!tech.namshi.com/join-us

github.com/namshi

twitter.com/TechNamshi

tech.namshi.com