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

About the Docker platform

About the Docker platform

Avatar for Bence Dányi

Bence Dányi

April 08, 2016
Tweet

More Decks by Bence Dányi

Other Decks in Programming

Transcript

  1. Introduction to Docker ▶ Docker engine ▶ Docker machine ▶

    Docker compose ▶ Docker swarm ▶ Docker hub
  2. VM vs container       

                                
  3. VM vs container VM ▶ Hardware virtualization ▶ Any OS

    ▶ Overhead (even with hardware support) Container ▶ Operating-system-level virtualization ▶ Shared kernel ▶ Almost no overhead
  4. Short history ▶ Solomon Hykes ▶ dotCloud (PaaS) internal project

    ▶ 2013: open source ▶ 2016: 30000+ github stars, 1300 contributors
  5. Docker image ▶ Analogy: A VM snapshot ▶ Read-only layers

    ▶ Union File System ▶ Storage driver: AUFS, OverlayFS, devicemapper, etc.     
  6. Docker container ▶ Analogy: A running VM ▶ Isolated from

    the host ▶ But uses the same kernel (it’s not virtualization!) ▶ Linux host & Linux container ▶ Execution drivers: ▶ LXC ▶ libcontainer ▶ Isolation method: cgroups ▶ Namespace isolation (PID, mount, net, ipc) ▶ Resource limiting (memory, swap) ▶ Prioritization (CPU, I/O) ▶ $ docker run ubuntu echo 'Hello world!'
  7. Resource limits ▶ Memory ▶ --memory=128M ▶ --memory-swap=1G ▶ etc.

    ▶ CPU ▶ --cpu-quota=10 ▶ --cpu-period=100 ▶ etc. ▶ I/O device r/w ▶ --device-write-bps=1mb ▶ etc.
  8. Interactions with containers: Network ▶ $ docker network [...] ▶

    Types: ▶ Bridged ▶ Overlay (software defined network) ▶ Works between hosts! ▶ VXLAN: Layer-2 (Ethernet) frames embedded into Layer-4 (UDP) frames ▶ Custom (via plugins) ▶ Discover container by name: --name [name] ▶ Built-in DNS server ▶ Expose port on the host: -p [host]:[guest]
  9. Interactions with containers: Data volumes ▶ Declare volume in container

    A ▶ $ docker run -v [/path/to/volume] --name A [...] ▶ Import volumes from A in container B ▶ $ docker run --volumes-from A --name B [...] ▶ Mount host path inside container ▶ $ docker run -v [/host/path/]:[/container/path] [...]
  10. Building Docker Images $ docker run [...] $ docker commit

    [container] [...] $ docker tag [image] [name]
  11. Dockerfiles ▶ Programmatically building images (ADD, RUN, CMD, etc.) ▶

    $ docker build -t [name] . FROM ubuntu RUN apt-get update && \ apt-get install htop CMD htop
  12. Docker Machine ▶ Automatic Docker host provisioning ▶ Providers: ▶

    VirtualBox ▶ VMWare ▶ Hyper-V ▶ Azure ▶ OpenStack ▶ Digital Ocean ▶ etc.                 
  13. Docker Machine ▶ Create: ▶ $ docker-machine create --driver virtualbox

    felho ▶ Activate: ▶ $ docker-machine env felho ▶ Manage: ▶ $ docker-machine start felho ▶ $ docker-machine stop felho
  14. Docker Compose ▶ Orchestration of multiple containers ▶ Describes services

    with a declarative syntax (docker-compose.yml) ▶ $ docker-compose up ▶ $ docker-compose down
  15. Docker Swarm ▶ Clustering: a single virtual Docker from a

    Docker host pool ▶ Discovery backend: maintains the list of nodes ▶ Swarm manager: virtual Docker host ▶ Swarm agent: advertises itself
  16. Docker Swarm        

                 
  17. Container filters & strategies ▶ Stategy: general algorithm to assign

    containers to hosts ▶ spread, binpack, random, etc. ▶ Filter: assign containers to hosts based on constraints: ▶ constraint:storage==ssd ▶ affinity:container==mycontainer ▶ affinity:image==~redis ▶ etc.
  18. Docker Hub ▶ The official image repository ▶ Everyone can

    push images (user/image:tag) ▶ Automatic image build process (using Dockerfiles) ▶ Open source, you can host your own repository! ▶ Public & private visibility