Upgrade to Pro — share decks privately, control downloads, hide ads and more …

A Quick Intro to Docker - The Next Big Thing in PaaS

csears
August 13, 2013

A Quick Intro to Docker - The Next Big Thing in PaaS

A basic overview and walk-through of Docker functionality.

Presented at the Cloud Computing Atlanta Meetup (http://meetup.com/acloud) on 8/13/13.

csears

August 13, 2013
Tweet

More Decks by csears

Other Decks in Technology

Transcript

  1. A  Quick  Intro  to  Docker*  
    Chris  Sears  
    Cloud  Compu9ng  Atlanta  Meetup  
    8/13/2013  
     
    *  The  Next  Big  Thing  in  PaaS  

    View Slide

  2. PaaS?  
    •  PlaHorm-­‐as-­‐a-­‐Service  
    – PaaS  =>  App-­‐level  abstrac9on  layer  
    – IaaS  =>  VM-­‐level  abstrac9on  layer  
    •  Examples:  
    – Heroku  
    – Google  AppEngine  
    – DotCloud  
    – Cloud  Foundry  
    – OpenShiV  

    View Slide

  3. Docker?  
    •  Open  source  app  container  management  tool  
    •  Both  a  standard  and  a  reference  
    implementa9on  
    •  Created  by  DotCloud  
    •  WriYen  in  Go  (golang)  
    •  Uses  advanced  Linux  kernel  features:  
    – LXC,  AUFS,  cgroups,  namespaces  

    View Slide

  4. What’s  the  big  idea?    
    •  Create  a  standard  for  “container-­‐izing”  apps  
    •  Make  apps  easy  to  package,  deploy  and  run  
    •  Regardless  of  language,  run9me,  or  backend  
    •  Any  OS,  as  long  as  it’s  Linux  (and  Ubuntu*)  
    *As  of  August  2013.  BusyBox  also  available.  Other  distros  should  be  supported  soon.  

    View Slide

  5. Let’s  see  it  in  ac9on…  
     
    (with  help  from  Vagrant)  

    View Slide

  6. # Download Docker and Vagrant box
    git clone https://github.com/dotcloud/
    docker.git docker-demo
    cd docker-demo

    View Slide

  7. # Boot the Vagrant host, ssh into it,
    # become root, install curl
    vim Vagrantfile
    # add: config.vm.forward_port 5000, 5000
    vagrant up
    vagrant ssh
    sudo su -
    apt-get install curl

    View Slide

  8. # Download an Ubuntu image
    # Launch 'Hello World' example container
    docker pull ubuntu
    docker run ubuntu /bin/echo hello world
    # Check hostname inside the container
    docker run ubuntu hostname
    hostname

    View Slide

  9. # Launch an interactive bash prompt
    docker run -i -t ubuntu /bin/bash
    docker run -i -t ubuntu /bin/bash
    hostname
    cd /tmp
    echo foo > bar
    exit
    ls /tmp

    View Slide

  10. # Launch an interactive bash prompt
    docker run -i -t ubuntu /bin/bash
    # If you see an error, ignore and retry…
    docker run -i -t ubuntu /bin/bash
    hostname
    # Try writing to container file system
    echo foo > /tmp/bar
    ls –la /tmp
    exit
    # Verify /tmp/bar doesn’t exist in host FS
    ls –la /tmp

    View Slide

  11. # Launch 'Hello World Loop' example
    CONTAINER_ID=$(docker run -d ubuntu /bin/sh
    -c "while true; do echo hello world
    at...; date; sleep 1; done")
    echo $CONTAINER_ID
    docker logs $CONTAINER_ID
    docker attach $CONTAINER_ID
    docker ps
    docker stop $CONTAINER_ID
    docker ps

    View Slide

  12. # Launch a Python Web App example
    docker pull shykes/pybuilder
    URL=http://github.com/shykes/helloflask/
    archive/master.tar.gz
    BUILD_JOB=$(docker run -d -t shykes/
    pybuilder:latest /usr/local/bin/
    buildapp $URL); docker attach
    $BUILD_JOB
    BUILD_IMG=$(docker commit $BUILD_JOB demo)
    WEB_WORKER=$(docker run -d -p :5000
    $BUILD_IMG /usr/local/bin/runapp)
    curl http://127.0.0.1:5000
    # go to http://127.0.0.1:5000 in browser

    View Slide

  13. (Assuming  that  all  worked)  
     
     
    Hooray,  it  worked!  
     
     

    View Slide

  14. Friends  of  Docker  
    Deis   deis.io  
    Flynn   flynn.io  
    Dokku   github.com/progrium/dokku  
    Vagrant   vagrantup.com  
    OpenStack   github.com/dotcloud/
    openstack-­‐docker  

    View Slide

  15. Q  &  A  
    csears  (at)  gmail  (dot)  com  
    @csears  
     
    For  more  Docker:  
    docker.io  
     
    Credit:  Images  and  example  code  were  borrowed  from  
    Docker’s  site  and  excellent  documenta9on.  
     

    View Slide