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

Edmonton Go September 2014 - Docker

Edmonton Go September 2014 - Docker

Fletcher Nichol

September 22, 2014
Tweet

More Decks by Fletcher Nichol

Other Decks in Technology

Transcript

  1. –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.”
  2. Docker Daemon Runs on host machine ! Listens on Unix

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

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

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

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

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

    mechanism for public images ! “docker pull ubuntu”
  8. > tar cC /path/to/your/app . | ./buildstep myapp > docker

    run -d myapp /bin/bash -c "/start web"
  9. 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
  10. Not Magic: Roll Your Own Very small image footprint !

    All software and dependencies are known ! No need for compiler on running image
  11. FROM ubuntu MAINTAINER Fletcher Nichol <[email protected]> ! RUN apt-get update

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

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

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

    Packaged in minimal Docker image ! Credentials injected on container start
  15. > ./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)
  16. FROM progrium/busybox MAINTAINER Fletcher Nichol <[email protected]> ! # 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"]
  17. 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