Slide 1

Slide 1 text

Linux  Containers  &  Docker   Ahmet  Alp  Balkan   8/14/2014   NOT  MICROSOFT  CONFIDENTIAL  

Slide 2

Slide 2 text

‘Real’  containers  

Slide 3

Slide 3 text

What  is  special  about  containers?  

Slide 4

Slide 4 text

Power  of  Containers   •  Standard  format  everybody  agrees  on   •  Once  you  seal  the  box,  it  gets  shipped  “as  is”   •  SeparaVon  of  concerns   – Building  ó  Packaging  ó  Shipping  

Slide 5

Slide 5 text

Containers  vs.  VMs  

Slide 6

Slide 6 text

Type  1  Hypervisor     Hardware   VM   VM   OperaVng  System   OperaVng  System   bins/libs   bins/libs   App   App   App   App   Hypervisor   Kernel  

Slide 7

Slide 7 text

Type  2  Hypervisor     Hardware   Hypervisor  So[ware   VM   VM   OperaVng  System   OperaVng  System   bins/libs   bins/libs   App   App   App   App   OperaVng  System   App   App   App  

Slide 8

Slide 8 text

Linux  Containers   Hardware   OperaVng  System  (Linux)   bins/libs   Container   Container   bins/libs   App   App   App  

Slide 9

Slide 9 text

lxc:  Linux  Containers   •  OS-­‐Level  virtualizaVon,  no  Hypervisor   •  Namespacing   –  PIDs   –  user  IDs   –  network  tables   –  mounted  drivers   –  …   •  Started  in  2006.   •  Developed  by  a  team  of  4   –  v1.0  in  2014.  

Slide 10

Slide 10 text

cgroups:  Control  Groups   •  Fair  resource  usage  sharing  for  Linux  kernel   – CPU   – Memory   – I/O   •  Started  in  2007.   – by  2  Google  Engineers  

Slide 11

Slide 11 text

Distributed  ApplicaVon  Model   Front-­‐end  (web)   App  services   Background  workers   DB   Cache  Servers  

Slide 12

Slide 12 text

Advantages  of  containers   •  Only  one  kernel  runs  on  the  machine   •  No  Hypervisor  overhead.   –  Apps  directly  run  on  CPU   –  Rack  space  &  power  &  more  free  CPU  cycles   •  Run  different  versions  of  OS  on  same  server   –  Run  different  OSes  on  the  same  server   •  Process  isolaVon  &  security  

Slide 13

Slide 13 text

Use  of  Linux  Containers   •  Borg   –  Google’s  “secret  sauce”   –  Everything  runs  in  containers   –  Not  open  source     •  Mesos   –  Developed  by  Twiger   –  Open  sourced   “IT’S  A  WAY  OF  STITCHING  TOGETHER  A   COLLECTION  OF  MACHINES  INTO,  BASICALLY,   A  BIG  COMPUTER.”  

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

…is  a  Linux  container  engine  

Slide 16

Slide 16 text

…is  Open  Source  

Slide 17

Slide 17 text

…is  also  a  company.  

Slide 18

Slide 18 text

Why  was  Docker  born?   •  Shipping  code  to  servers  is  hard   •  It’s  hard  to  glue  the  technology   – LXC  +  cgroups   – lmcky:  “Let  me  contain  that  for  you”   •  open  source  version  of  Google’s  container  stack     •  There  is  no  standard  image  format  

Slide 19

Slide 19 text

Another  moVve:  eliminaVng  Ops   •  So[ware  used  to  be  deployed  by  ops  teams   •  Docker  might  be  “the  first  true  DevOps  tool”   – Increased  shipment  cadence   – Fast  moving  engineering  culture   •  Sysadmins  no  more.   – A  great  abstracVon  over  infrastructure.  

Slide 20

Slide 20 text

Why  is  Docker  special?   •  The  real  value  is  not  technology.   •  It’s  “gelng  people  to  agree  on  something”.   – Packaging  and  delivery  method.  

Slide 21

Slide 21 text

Cloud  as  one  big  machine   docker  client   $  docker  run  …   libswarm  

Slide 22

Slide 22 text

Demo  Vme   Linux  VM  on  Azure   docker  daemon   docker  client   Container   Container   App   App  

Slide 23

Slide 23 text

Docker  Image  Layers   ubuntu   apache+php   ADD    /my/applicaIon   ADD    /my/configuraIon   200  MB   250  MB   260  MB   261  MB   50  MB  diff   10  MB  diff   1  MB  diff  

Slide 24

Slide 24 text

Layers  &  Reuse   Base  Linux  DistribuVon  image   Google  configuraVon   mapreduce   crawler   web  frontend   video  encoder  

Slide 25

Slide 25 text

Dockerfile   FROM ubuntu:latest MAINTAINER Ahmet RUN apt-get install nginx mysql python ADD /my/app /var/www/app ENTRYPOINT /var/www/app/server.py $ docker build

Slide 26

Slide 26 text

Dockerfile  inheritance   FROM microsoft/aspnet-vnext MAINTAINER Bob ADD /my/app /var/www/app ENTRYPOINT /var/www/app/Server.cs Reuse  

Slide 27

Slide 27 text

Docker  use  cases   •  Just  like  VMs  in  producVon   –  SpoVfy,  eBay   •  One  off  tasks   –  Build  automaVon   –  ConVnuous  integraVon   –  TesVng   –  Bug  repros   •  Making  the  cloud  look  like  “one  big  machine”    

Slide 28

Slide 28 text

…  is  a  minimal  host  OS  (Linux)  for  Docker.  

Slide 29

Slide 29 text

…is  an  open  source  project  

Slide 30

Slide 30 text

…is  also  a  company  

Slide 31

Slide 31 text

…is  auto  self-­‐updaVng.  

Slide 32

Slide 32 text

…has  rollbacks.     (updates  are  atomic)  

Slide 33

Slide 33 text

Clustering   •  Kubernetes  (by  Google)   –  for  clustering  Docker  containers  across  nodes   –  Inspired  by  Google’s  internal  systems  like  Borg/ Omega   –  Open  source   –  10+  years  of  experience  in  running  containers   –  ContribuVons  by  Microso[  &  IBM  etc.   •  fleet  (by  CoreOS)   –  for  clustering  CoreOS  nodes   –  Open  source    

Slide 34

Slide 34 text

Cons  of  Docker   •  Linux  only   – Probably  will  never  support  Windows.     •  Security  risks     •  Same  pricing  as  VMs   •  SVll  developing  ecosystem  

Slide 35

Slide 35 text

Further  reading   •  Return  of  the  Borg  (Wired)   •  Inside  the  Borg  and  Mesos  (Verge)   •  Google  Open  Sources  Its  Secret  Weapon  in  Cloud   CompuVng:  Kubernetes  (Wired)   •  Docker:  hgp://docker.com   •  CoreOS:  hgp://coreos.com   •  Running  Docker  on  Windows  (docker.com)   •  Docker  on  Azure  (azure.com)   •  Omega:  flexible,  scalable  schedulers  for  large  compute   clusters  SIGOPS  EuroSys  2013,  ACM,  pp.  351-­‐364     (Google  Research)  

Slide 36

Slide 36 text

Thanks.   QuesVons?