A Gentle Introduction

https://goo.gl/fMWxOt

Who is this guy?

Dale Alleshouse

 

@HumpbackFreak

hideoushumpbackfreak.com

github.com/dalealleshouse

Goals

  • Understand Container Technology at a High Level
  • Understand the Appeal/Benefits of Containers
  • Provide a Starting Point for Working with Docker
  • Have Fun - Docker is cool

Agenda

  • What is a container?

  • How do containers work?

  • Why use containers? (Evolution of applications)

  • Docker

  • Awesome Demo

  • What Now?

What is a Container?

  • Multiple Definitions

    • OS Containers vs. Application Containers

    • Many Implementations

  • Container Technologies

    • FreeBSD Jail - 2000

    • Solaris - 2004

    • LXC - 2008

    • Docker - 2013

    • CoreOS rkt (pronounced rocket)

    • https://en.wikipedia.org/wiki/Operating-system-level_virtualization

Container Essentials

  • Kernel Virtualization

  • Isolated, resource controlled, and portable operating environment

Analogies

  • Lightweight VM?
    • Kinda... Not Really...
    • CLI Only
  • ​chroot on Steroids
  • Obligatory Shipping Analogy
    • Container Runtime is a Shipping Barge
    • Containers are Standardized Shipping Crates
  • Group of processes with extended isolation capabilities

How do Containers Work?

  • Linux Kernel
    • You can create a container with standard shell commands
  • Kernel Technologies
    • Namespaces
    • Control Groups (cgroups)
    • Union File System
    • Container Format
  • Windows has similar concepts for Server 2016

Namespaces

  • Process with entirely separate machine view
  • Linux Namespaces
    • mount - mount points
    • UTS - Host name
    • IPC - Inter Process Communication (message queues, etc...)
    • Network - network devices, stacks, and ports
    • User - user and group IDs
    • PID - process IDs

Control Groups (cgroups)

  • Regulates the resource usage for a collection of processes
    • CPU
    • memory
    • disk I/O
    • network
    • devices
  • ​Features
    • Resource limiting
    • Prioritization
    • Accounting
    • Control

Union File System

  • Separate file systems overlaid forming a single coherent file system
  • Drivers
    • UnionFS - 1990
    • AUFS - 2006
    • Btrfs
    • devicemapper
    • overlayfs/overlay2
    • Many More
  • ​Driver set on Docker Daemon
  • Why?
    • Performance
    • Shared Storage

Union File System

Container Format

  • Packages namespaces, cgroups, and UnionFS into a wrapper
  • Typically aligns Namespace and cgroup boundaries
  • Competing Container Formats
    • LXC
    • appc - CoreOS rkt
    • libcontainer - Docker
  • OCI (Open Container Initiative)
    • Standards for container formats and runtimes
    • None are in full compliance YET

Evolution of Applications

Why Use Containers?

Long Live Hypervisor!

  • Hypervisor is not dead
  • Container Runtime on top of Hypervisor
  • Advantages
    • Install any OS side-by-side
    • Security Isolation between host and VM
  • Hypervisor Containers
  • VM on Container Runtimes

Docker

  • Made containers easy by providing a simplistic CLI
  • Image Distribution
  • Components
    • Docker Engine
    • Images
    • Registries

Docker Engine

  • Server (Daemon)
    • dockerd
    • Responsible for container operations
  • REST API
    • Sends commands to server
  • Client (CLI)
    • Issues commands to the REST API

Images

  • Complete IMMUTABLE Union File System
  • Layered
    • Each layer is interchangeable
    • Containers can share layers
    • Writable top layer at runtime

Images & UnionFS

Registries

  • Repository for managing images
    • Similar to NPM or Nuget except with images instead of packages
  • Distribute images easily
    • Major contributing factor to the success of docker
  • Examples
    • Docker Hub
    • Quay
    • Private

Docker for Windows/Mac

  • Creates Linux Alpine machine in hypervisor
  • Not intended for production scenarios
  • Do not confuse with Docker ON windows
    • MS implemented containers for Server 2016
    • Linux and Windows containers don't run side by side

Docker on Windows

  • https://www.youtube.com/watch?v=85nCF5S8Qok

(https://blog.docker.com/2016/09/dockerforws2016/)

Awesome Demo

git clone https://github.com/dalealleshouse/docker-training
cd docker-training/docker
docker-compose up
docker-compose scale java-consumer=5

What Now?

  • Install Docker
    • https://www.docker.com/products/docker
  • Learn Docker
    • https://docs.docker.com/
    • Nigel Poulton on Pluralsight
    • The Docker Book: Containerization is the new virtualization by James Turnbull
    • Callibrity Training (bstewart@callibrity.com)
  • Maybe I can Help
    • @HumpbackFreak

Thank You!

https://goo.gl/nB8juV