antonis kalipetis - @akalipetis docker athens meetupfiles.meetup.com/13858262/docker athens meetup...

27
Introduction to Docker Antonis Kalipetis - @akalipetis Docker Athens Meetup

Upload: others

Post on 20-May-2020

11 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Antonis Kalipetis - @akalipetis Docker Athens Meetupfiles.meetup.com/13858262/Docker Athens Meetup 01... · Docker Athens Meetup. Contents • Introduction to Docker, Containers,

Introduction to Docker

Antonis Kalipetis - @akalipetis Docker Athens Meetup

Page 2: Antonis Kalipetis - @akalipetis Docker Athens Meetupfiles.meetup.com/13858262/Docker Athens Meetup 01... · Docker Athens Meetup. Contents • Introduction to Docker, Containers,

Contents

•  Introduction to Docker, Containers, and the Matrix from Hell • Why people care: Separation of Concerns • Technical Discussion • Use Cases • Docker Futures • Learn More

• Demos • Networking

Page 3: Antonis Kalipetis - @akalipetis Docker Athens Meetupfiles.meetup.com/13858262/Docker Athens Meetup 01... · Docker Athens Meetup. Contents • Introduction to Docker, Containers,

Static website

Web frontend

User DB

Queue Analytics DB

Background workers

API endpoint

nginx 1.5 + modsecurity + openssl + bootstrap 2

postgresql + pgv8 + v8

hadoop + hive + thrift + OpenJDK

Ruby + Rails + sass + Unicorn

Redis + redis-sentinel

Python 3.0 + celery + pyredis + libcurl + ffmpeg + libopencv + nodejs + phantomjs

Python 2.7 + Flask + pyredis + celery + psycopg + postgresql-client

Development VM

QA server

Public Cloud

Disaster recovery

Contributor’s laptop

Production Servers

The Challenge Mul$p

licity

 of  S

tacks  

Mul$p

licity

 of  

hardware  

environm

ents   Production Cluster

Customer Data Center

Do  services  and  apps  interact  

appropriately?  

Can  I  migrate  

smoothly  and  quickly?  

Page 4: Antonis Kalipetis - @akalipetis Docker Athens Meetupfiles.meetup.com/13858262/Docker Athens Meetup 01... · Docker Athens Meetup. Contents • Introduction to Docker, Containers,

The Matrix From Hell

Static website

Web frontend

Background workers

User DB

Analytics DB

Queue

Development VM QA Server Single Prod

Server Onsite Cluster Public Cloud Contributor’

s laptop Customer

Servers

? ? ? ? ? ? ?

? ? ? ? ? ? ?

? ? ? ? ? ? ?

? ? ? ? ? ? ?

? ? ? ? ? ? ?

? ? ? ? ? ? ?

Page 5: Antonis Kalipetis - @akalipetis Docker Athens Meetupfiles.meetup.com/13858262/Docker Athens Meetup 01... · Docker Athens Meetup. Contents • Introduction to Docker, Containers,

Mul$p

licity

 of  G

oods  

Mul$p

ilicity  of  

metho

ds  fo

r  tran

spor$n

g/storing  

Do  I  worry  about  

how  goods  interact  

(e.g.  coffee  beans  next  to  spices)  

Can  I  transport  quickly  and  sm

oothly  (e.g.  from

 boat  to  train  to  truck)  

Cargo Transport Pre-1960

Page 6: Antonis Kalipetis - @akalipetis Docker Athens Meetupfiles.meetup.com/13858262/Docker Athens Meetup 01... · Docker Athens Meetup. Contents • Introduction to Docker, Containers,

? ? ? ? ? ? ?

? ? ? ? ? ? ?

? ? ? ? ? ? ?

? ? ? ? ? ? ?

? ? ? ? ? ? ?

? ? ? ? ? ? ?

Also a matrix from hell

Page 7: Antonis Kalipetis - @akalipetis Docker Athens Meetupfiles.meetup.com/13858262/Docker Athens Meetup 01... · Docker Athens Meetup. Contents • Introduction to Docker, Containers,

Mul$p

licity

 of  G

oods  

Mul$p

licity

 of  

metho

ds  fo

r  transpor$n

g/storing  

Do  I  worry  about  

how  goods  interact  

(e.g.  coffee  beans  next  to  spices)  

Can  I  transport  quickly  and  sm

oothly  (e.g.  from

 boat  to  train  to  truck)  

Solution: Intermodal Shipping Container

…in between, can be loaded and unloaded, stacked, transported efficiently over long distances, and transferred from one mode of transport to another  

A standard container that is loaded with virtually any goods, and stays sealed until it reaches final delivery.  

Page 8: Antonis Kalipetis - @akalipetis Docker Athens Meetupfiles.meetup.com/13858262/Docker Athens Meetup 01... · Docker Athens Meetup. Contents • Introduction to Docker, Containers,

Static website Web frontend User DB Queue Analytics DB

Development VM

QA server Public Cloud Contributor’s laptop

Docker is a shipping container system for code

Mul$p

licity

 of  Stacks  

Mul$p

licity

 of  

hardware  

environm

ents  

Production Cluster Customer Data Center

Do  services  and  apps  interact  

appropriately?  

Can  I  migrate  

smoothly  and  quickly  

…that can be manipulated using standard operations and run consistently on virtually any hardware platform  

An engine that enables any payload to be encapsulated as a lightweight, portable, self-sufficient container…  

Page 9: Antonis Kalipetis - @akalipetis Docker Athens Meetupfiles.meetup.com/13858262/Docker Athens Meetup 01... · Docker Athens Meetup. Contents • Introduction to Docker, Containers,

Static website

Web frontend

Background workers

User DB

Analytics DB

Queue

Development VM QA Server Single Prod

Server Onsite Cluster Public Cloud Contributor’

s laptop Customer

Servers

Docker eliminates the matrix from Hell

Page 10: Antonis Kalipetis - @akalipetis Docker Athens Meetupfiles.meetup.com/13858262/Docker Athens Meetup 01... · Docker Athens Meetup. Contents • Introduction to Docker, Containers,

Contents

•  Introduction to Docker, Containers, and the Matrix from Hell • Why people care: Separation of Concerns • Technical Discussion • Use Cases • Docker Futures • Learn More

• Demos • Networking

Page 11: Antonis Kalipetis - @akalipetis Docker Athens Meetupfiles.meetup.com/13858262/Docker Athens Meetup 01... · Docker Athens Meetup. Contents • Introduction to Docker, Containers,

Why Developers Care

•  Build once…(finally) run anywhere* •  A clean, safe, hygienic and portable runtime environment for your app. •  No worries about missing dependencies, packages and other pain points during

subsequent deployments. •  Run each app in its own isolated container, so you can run various versions of libraries

and other dependencies for each app without worrying •  Automate testing, integration, packaging…anything you can script •  Reduce/eliminate concerns about compatibility on different platforms, either your own or

your customers. •  Cheap, zero-penalty containers to deploy services? A VM without the overhead of a VM?

Instant replay and reset of image snapshots? That’s the power of Docker

* With the 0.7 release, we support any x86 server running a modern Linux kernel (3.2+ generally. 2.6.32+ for RHEL 6.5+, Fedora, & related)

Page 12: Antonis Kalipetis - @akalipetis Docker Athens Meetupfiles.meetup.com/13858262/Docker Athens Meetup 01... · Docker Athens Meetup. Contents • Introduction to Docker, Containers,

Why Devops Cares?

• Configure once…run anything •  Make the entire lifecycle more efficient, consistent, and repeatable •  Increase the quality of code produced by developers. •  Eliminate inconsistencies between development, test, production, and customer

environments •  Support segregation of duties •  Significantly improves the speed and reliability of continuous deployment and continuous

integration systems •  Because the containers are so lightweight, address significant performance, costs,

deployment, and portability issues normally associated with VMs

Page 13: Antonis Kalipetis - @akalipetis Docker Athens Meetupfiles.meetup.com/13858262/Docker Athens Meetup 01... · Docker Athens Meetup. Contents • Introduction to Docker, Containers,

Why it works—separation of concerns

•  Rhea the Developer •  Worries about what’s “inside” the

container •  Her code •  Her Libraries •  Her Package Manager •  Her Apps •  Her Data

•  All Linux servers look the same

•  Kronos the Ops Guy •  Worries about what’s “outside”

the container •  Logging •  Remote access •  Monitoring •  Network config

•  All containers start, stop, copy, attach, migrate, etc. the same way

Page 14: Antonis Kalipetis - @akalipetis Docker Athens Meetupfiles.meetup.com/13858262/Docker Athens Meetup 01... · Docker Athens Meetup. Contents • Introduction to Docker, Containers,

Contents

•  Introduction to Docker, Containers, and the Matrix from Hell • Why people care: Separation of Concerns • Technical Discussion • Use Cases • Docker Futures • Learn More

• Demos • Networking

Page 15: Antonis Kalipetis - @akalipetis Docker Athens Meetupfiles.meetup.com/13858262/Docker Athens Meetup 01... · Docker Athens Meetup. Contents • Introduction to Docker, Containers,

More technical explanation

•  High Level—It’s a lightweight VM •  Own process space •  Own network interface •  Can run stuff as root •  Can have its own /sbin/init

(different from host) •  <<machine container>>

•  Low Level—It’s chroot on steroids

•  Can also not have its own /sbin/init

•  Container=isolated processes •  Share kernel with host •  No device emulation (neither

HVM nor PV) from host) •  <<application container>>

•  Run everywhere •  Regardless of kernel version

(2.6.32+) •  Regardless of host distro •  Physical or virtual, cloud or not •  Container and host architecture

must match*

•  Run anything •  If it can run on the host, it can

run in the container •  i.e. if it can run on a Linux

kernel, it can run

WHY   WHAT  

Page 16: Antonis Kalipetis - @akalipetis Docker Athens Meetupfiles.meetup.com/13858262/Docker Athens Meetup 01... · Docker Athens Meetup. Contents • Introduction to Docker, Containers,

App  A              

Containers vs. VMs

Hypervisor  (Type  2)  

Host  OS  

Server  

       

Guest  OS          

       

Bins/  Libs          

App  A’              

       

Guest  OS          

       

Bins/  Libs          

App  B              

       

Guest  OS          

       

Bins/  Libs          

App  A’  

Docker    

Host  OS  

Server  

       

Bins/Libs  

       

App  A  

       

Bins/Libs  

       

App  B  

App  B’  

App  B’  

App  B’  VM  

Container  

Containers  are  isolated,  but  share  OS  and,  where  appropriate,  bins/libraries    

     

Guest  OS          

       

Guest  OS          

…result  is  significantly  faster  deployment,    much  less  overhead,  easier  migra$on,  faster  restart  

Page 17: Antonis Kalipetis - @akalipetis Docker Athens Meetupfiles.meetup.com/13858262/Docker Athens Meetup 01... · Docker Athens Meetup. Contents • Introduction to Docker, Containers,

Why are Docker containers lightweight?

App  A              

       

Bins/  Libs          

App  A’              

       

Guest  OS          

       

Bins/  Libs          

VMs  Every  app,  every  copy  of  an  

app,  and  every  slight  modifica$on  of  the  app  requires  a  new  virtual  server  

App  A              

       

Guest  OS                

       

Bins/  Libs          

       

Guest  OS                

       

Guest  OS                

VMs          

Bins/  Libs          

App  A  

Original  App  (No  OS  to  take  

up  space,  resources,  or  require  restart)  

App  Δ    

       Bins/  

Modified  App    Copy  on  write  capabili$es  allow  us  to  only  save  the  diffs  Between  container  A  and  container  A’  

Copy  of  App  

No  OS.  Can  Share  bins/libs  

App  A  

Containers  

Page 18: Antonis Kalipetis - @akalipetis Docker Athens Meetupfiles.meetup.com/13858262/Docker Athens Meetup 01... · Docker Athens Meetup. Contents • Introduction to Docker, Containers,

What are the basics of the Docker system?

       

Source  Code  

Repository  

Dockerfile  For    A  

Docker  Engine  

   

Docker  Container  Image  Registry  

Build  

Docker    

Host  2  OS    (Linux)  

Container  A  

Container  B  

Container  C  

Container  A  

Push  

Search   Pull  

Run  

Host  1    OS  (Linux)  

Page 19: Antonis Kalipetis - @akalipetis Docker Athens Meetupfiles.meetup.com/13858262/Docker Athens Meetup 01... · Docker Athens Meetup. Contents • Introduction to Docker, Containers,

Changes and Updates

Docker  Engine  

   

Docker  Container  Image  Registry  

Docker  Engine  

Push  

Update  

       

Bins/  Libs          

App  A  

App  Δ    

       Bins/  

Base    Container  Image  

Host  is  now  running  A’’    

Container  Mod  A’’  

App  Δ    

       Bins/  

       

Bins/  Libs          

App  A  

       Bins/  

       

Bins/  Libs          

App  A’’  

Host  running  A  wants  to  upgrade  to  A’’.  Requests  update.  Gets  only  diffs    

Container  Mod  A’  

Page 20: Antonis Kalipetis - @akalipetis Docker Athens Meetupfiles.meetup.com/13858262/Docker Athens Meetup 01... · Docker Athens Meetup. Contents • Introduction to Docker, Containers,

Contents

•  Introduction to Docker, Containers, and the Matrix from Hell • Why people care: Separation of Concerns • Technical Discussion • Use Cases • Docker Futures • Learn More

• Demos • Networking

Page 21: Antonis Kalipetis - @akalipetis Docker Athens Meetupfiles.meetup.com/13858262/Docker Athens Meetup 01... · Docker Athens Meetup. Contents • Introduction to Docker, Containers,

Use Cases •  Ted Dziuba on the Use of Docker for Continuous Integration at Ebay Now

•  https://speakerdeck.com/teddziuba/docker-at-ebay •  http://www.youtube.com/watch?feature=player_embedded&v=0Hi0W4gX--4

•  Sasha Klizhentas on use of Docker at Mailgun/Rackspace •  http://www.youtube.com/watch?feature=player_embedded&v=CMC3xdAo9RI

•  Sebastien Pahl on use of Docker at CloudFlare •  http://www.youtube.com/watch?feature=player_embedded&v=-Lj3jt_-3r0

•  Cambridge HealthCare •  http://blog.howareyou.com/post/62157486858/continuous-delivery-with-docker-and-jenkins-

part-i

•  Red Hat Openshift and Docker •  https://www.openshift.com/blogs/technical-thoughts-on-openshift-and-docker

Page 22: Antonis Kalipetis - @akalipetis Docker Athens Meetupfiles.meetup.com/13858262/Docker Athens Meetup 01... · Docker Athens Meetup. Contents • Introduction to Docker, Containers,

Use Cases — From Our Community

Page 23: Antonis Kalipetis - @akalipetis Docker Athens Meetupfiles.meetup.com/13858262/Docker Athens Meetup 01... · Docker Athens Meetup. Contents • Introduction to Docker, Containers,

Contents

•  Introduction to Docker, Containers, and the Matrix from Hell • Why people care: Separation of Concerns • Technical Discussion • Use Cases • Docker Futures • Learn More

• Demos • Networking

Page 24: Antonis Kalipetis - @akalipetis Docker Athens Meetupfiles.meetup.com/13858262/Docker Athens Meetup 01... · Docker Athens Meetup. Contents • Introduction to Docker, Containers,

Docker Futures* •  Docker 0.11 (current release)

•  Linked containers can be accessed by hostname

•  Logs can now be returned with an optional timestamp

•  Shrink and stabilize Core •  Provide stable, pluggable API •  Nested containers •  We will consider this “production ready” •  Release candidate for 1.0

•  Docker 1.0 •  First officially stable release

Docker  0.1-­‐0.6  

AUFS  

Docker  0.8+  

LXC  

JAILS  

*  Time  based  releases  (1x/5wks)  

Page 25: Antonis Kalipetis - @akalipetis Docker Athens Meetupfiles.meetup.com/13858262/Docker Athens Meetup 01... · Docker Athens Meetup. Contents • Introduction to Docker, Containers,

Contents

•  Introduction to Docker, Containers, and the Matrix from Hell • Why people care: Separation of Concerns • Technical Discussion • Use Cases • Docker Futures • Learn More • Demos • Networking

Page 26: Antonis Kalipetis - @akalipetis Docker Athens Meetupfiles.meetup.com/13858262/Docker Athens Meetup 01... · Docker Athens Meetup. Contents • Introduction to Docker, Containers,

Want to learn more?

• www.docker.io: •  Documentation •  Getting started: interactive tutorial, installation instructions, getting

started guide, •  About: Introductory whitepaper: http://www.docker.io/the-whole-story/

• Github: dotcloud/docker •  IRC: freenode/#docker • Google groups: groups.google.com/forum/#!forum/docker-user • Twitter: follow @docker •  Next Meetups: 3-week schedule, we’ll try our best to keep the pace

Page 27: Antonis Kalipetis - @akalipetis Docker Athens Meetupfiles.meetup.com/13858262/Docker Athens Meetup 01... · Docker Athens Meetup. Contents • Introduction to Docker, Containers,

www.docker.io