Lock in $30 Savings on PRO—Offer Ends Soon! ⏳

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

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  
  2. PaaS?   •  PlaHorm-­‐as-­‐a-­‐Service   – PaaS  =>  App-­‐level  abstrac9on  layer

      – IaaS  =>  VM-­‐level  abstrac9on  layer   •  Examples:   – Heroku   – Google  AppEngine   – DotCloud   – Cloud  Foundry   – OpenShiV  
  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  
  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.  
  5. # 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
  6. # 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
  7. # 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
  8. # 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
  9. # 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
  10. # 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
  11. Friends  of  Docker   Deis   deis.io   Flynn  

    flynn.io   Dokku   github.com/progrium/dokku   Vagrant   vagrantup.com   OpenStack   github.com/dotcloud/ openstack-­‐docker  
  12. 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.