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

Introduction to containers and Docker - Golang Paris Meetup

Introduction to containers and Docker - Golang Paris Meetup

A quick and gentle introduction of linux containers and Docker.

Live demo files: https://github.com/foliea/docker-example

Adrien Folie

January 12, 2015
Tweet

More Decks by Adrien Folie

Other Decks in Programming

Transcript

  1. Introduction to containers Introduction to containers and Docker and Docker

    Golang Paris Meetup - 01/12/2015 Adrien Folie @folieadrien
  2. High level approach High level approach Lightweight VM own process

    space own network interface can run stuff as root can have it's own /sbin/init 1000x faster than a VM Easier to transfer and move efficiently Containers have no overhead Advantages "Machine container"
  3. Low level approach Low level approach chroot on steroids Can

    also not have its own /sbin/init Container = isolated process(es) Share kernel with host No device emulation "Application container"
  4. Standard format for Standard format for containers containers Dockerfiles Recipe

    to build a container Start FROM a base image RUN commands on top of it Easy to learn, easy to use FROM google/golang:1.4 ENV APP $GOPATH/src/folieadrien/docker-example COPY . $APP WORKDIR $APP CMD ["go", "run", "main.go"] docker build -t folieadrien/docker-example .
  5. Docker build Docker build Advantages Take a snapshot after each

    step Re-use those snapshots in future builds Doesn't re-run slow steps (package install...) when it's not necessary
  6. Docker run Docker run Execution is fast and lightweight ✔

    ~/dev/test 19:45 $ docker run -t folieadrien/docker-example Let's start a few containers
  7. Docker Hub Docker Hub docker push an image to the

    hub docker pull this image from any machine
  8. Docker Ecosystem Docker Ecosystem fig swarm machine Official Tools On

    GitHub 731 Contributors 18,301 stars 40,000 projects referencing docker