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

Edmonton Go September 2014 - Docker

Edmonton Go September 2014 - Docker

9891e8299426fb9b6e361b84b3155a2d?s=128

Fletcher Nichol

September 22, 2014
Tweet

More Decks by Fletcher Nichol

Other Decks in Technology

Transcript

  1. Docker Edmonton Go September, 2014 Fletcher Nichol @fnichol

  2. None
  3. What is Docker?

  4. –Docker Inc. “Develop, Ship and Run Any Application, Anywhere.”

  5. –Docker Inc. “Docker is a platform for developers and sysadmins

    to develop, ship, and run applications. Docker lets you quickly assemble applications from components and eliminates the friction that can come when shipping code. Docker lets you get your code tested and deployed into production as fast as possible.”
  6. –Me “Docker is version control for your application processes.”

  7. Why Docker?

  8. Faster delivery of applications

  9. Deploying & scaling more easily

  10. Higher density & running more workloads

  11. Components and Concepts

  12. Docker Daemon Runs on host machine ! Listens on Unix

    socket or TCP port ! Pre-defined API ! “docker -D”
  13. docker Binary Primary UI for Docker ! CLI tool !

    Interacts with Docker Daemon ! “docker ps”
  14. Docker Container Container-based virtualization ! Shared Linux Kernel ! Isolated

    processes, users, resources ! Started from an Image ! “docker run nginx”
  15. Layered format, using union file systems ! Can be tagged

    and versioned ! Source code for containers! ! “docker images” Docker Image
  16. Dockerfile Build images automatically from instructions ! Each instruction creates

    an image layer which is cached ! “docker build -t <tag> .”
  17. Docker Hub Primary source of registries of images ! Sharing

    mechanism for public images ! “docker pull ubuntu”
  18. Docker Demo

  19. None
  20. Go +

  21. Magic I: progrium/buildstep https://registry.hub.docker.com/u/ progrium/buildstep/ ! Heroku-style application builds using

    Docker and Buildpacks. ! Used by Dokku to make a mini-Heroku.
  22. > tar cC /path/to/your/app . | ./buildstep myapp > docker

    run -d myapp /bin/bash -c "/start web"
  23. Magic II: google/golang- runtime https://registry.hub.docker.com/u/ google/golang-runtime/ ! Automatically bundle a

    Go application with its dependencies ! No additional Dockerfile instructions
  24. > echo “FROM google/golang-runtime” > Dockerfile > docker build -t

    myapp . > docker run -d myapp
  25. Not Magic: Roll Your Own Very small image footprint !

    All software and dependencies are known ! No need for compiler on running image
  26. Go Application System Requirements • ?? • ?? • ??

  27. FROM ubuntu MAINTAINER Fletcher Nichol <fnichol@nichol.ca> ! RUN apt-get update

    RUN apt-get install -y autoconf bison build-essential curl git other- stuff amazing-collection-of-wasted-bytes-cmon-why ! # …
  28. > docker images ubuntu | \ grep latest | awk

    '{print $(NF-1) " " $NF}’ 194.2 MB
  29. > docker images progrium/busybox | \ grep latest | awk

    '{print $(NF-1) " " $NF}' 4.787 MB
  30. Deployment Example: tapasd https://github.com/fnichol/tapasd ! Daemon written in Go !

    Packaged in minimal Docker image ! Credentials injected on container start
  31. > ./bin/tapasd -help Usage of ./bin/tapasd: -concurrency=4: data directory for

    downloads -data=“/tmp/tapasd": data directory for downloads -interval=21600: number of seconds to sleep between retrying -oneshot=false: check and download once, then quit -pass="[required]": pass for RubyTapas account (required) -user="[required]": user for RubyTapas account (required)
  32. FROM progrium/busybox MAINTAINER Fletcher Nichol <fnichol@nichol.ca> ! # provide /etc/ssl/certs/ca-certificates.crt

    to container RUN opkg-install ca-certificates RUN for cert in `ls -1 /etc/ssl/certs/*.crt | grep -v /etc/ssl/certs/ ca-certificates.crt`; do cat "$cert" >> /etc/ssl/certs/ca- certificates.crt; done ! ADD https://github.com/fnichol/tapasd/releases/download/v0.1.0/ tapasd_linux_amd64 /bin/tapasd RUN chmod +x /bin/tapasd ! VOLUME ["/data"] ! ENTRYPOINT ["/bin/tapasd", "-data=/data"]
  33. > docker run -d fnichol/tapasd -user="user@example.com" -pass="nope"

  34. > docker images fnichol/tapasd | grep latest | awk '{print

    $(NF-1) " " $NF}' 21.45 MB
  35. Getting Started

  36. Official Guides https://docs.docker.com/installation/ #installation

  37. boot2docker http://boot2docker.io/

  38. dvm http://fnichol.github.io/dvm/

  39. Further Reading

  40. Docker Website https://www.docker.com/

  41. The Docker Book James Turnbull http://dockerbook.com/

  42. DockerCon 2014 Videos https://www.youtube.com/user/ dockerrun/

  43. Thanks! Edmonton Go September, 2014 Docker ! Fletcher Nichol @fnichol

  44. Photo Credits https://flic.kr/p/9abnoA https://flic.kr/p/eSN6wQ https://flic.kr/p/eP3dje https://flic.kr/p/iuZJCa https://flic.kr/p/5Sob5d https://flic.kr/p/a3NYdi https://flic.kr/p/jbQF9 https://flic.kr/p/2zyPrm

    https://flic.kr/p/6P7h6L https://flic.kr/p/aoCttn https://flic.kr/p/7S6vi1 https://flic.kr/p/aYqgh https://flic.kr/p/6hrYGj https://flic.kr/p/7TphJe https://flic.kr/p/5vMgkz https://flic.kr/p/aip3KU https://flic.kr/p/i1Lp1 https://flic.kr/p/nJLGvt