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

Containers: a Basic Look Under The Hood

Containers: a Basic Look Under The Hood

An intro to containers-- what are they really? How are they different from VMs? What are the building blocks of containers and how do they fit together?

David Julia

January 30, 2015
Tweet

More Decks by David Julia

Other Decks in Programming

Transcript

  1. Specifically LXC and Garden-Linux (Go Pivotal!) Let’s talk Linux **lmctfy

    (Google’s) and others are probably very similar!
  2. Cgroups - Resource Management Per-Group Limit, Control, and Monitoring of:

    • CPU, Memory utilization • Network Traffic priority • Block I/O (bandwidth, upper limits) • processes (checkpoint, freeze, restart)
  3. Namespaces - Isolation • PID • Network - iptables rules,

    routing tables, etc ◦ Can connect network namespaces via veth • UTS - hostname • Mount - different fs layout, read-only mounts • IPC - per namespace system V IPC • User -uid isolation (prevents setuid exploits)
  4. Process Virtual File System OverlayFS tmpfs (read only) EXT3, NFS,

    whateverFS (writable) dj@computer> echo “hello” > ~/hi hello dj@computer> ~/hi
  5. Process Virtual File System OverlayFS tmpfs (read only) EXT3, NFS,

    whateverFS (writable) dj@computer> cat ~/hi XP 4 LYFE!!!! dj@computer> ~/hi Found it!
  6. Process Virtual File System OverlayFS tmpfs (read only) EXT3, NFS,

    whateverFS (writable) dj@computer> cat ~/hi XP 4 LYFE!!!! dj@computer> ~/pi Found it! Didn’t find in highest priority fs!
  7. Containers Virtualized devices (network, disk) -different OS entirely -kernel modules

    for guest additions Moderated access to devices -same kernel as host Virtual Machines
  8. Containers Provisioning: 10 minutes Resource intensive Snapshotting: Minutes, disk intensive

    Provisioning: <1 sec, no real resource drain Snapshotting: Seconds Virtual Machines
  9. WHY Containers vs VM? Startup Time/resources Lightweight Don't incur performance

    penalty of hypervisor Don't need hardware assisted virtualization enabled (run same container on aws, local) Self-service
  10. VMs + Containers = <3 Given heterogeneous OS requirements in

    the enterprise (legacy .Net anyone?) VMs + Containerization = Best of Both Worlds *with a slight performance penalty
  11. Docker • Application-centric, not server-centric • User/Deployment Friendly: ◦ Versioned

    Images ◦ Central Image Repo ◦ Useful/Easy CLI ◦ easy to mount shared writable volumes ◦ easy to pass in env vars from host
  12. Docker: Deploy On server: >docker pull myImage:v1 >docker run myImage

    -e SECRET=”sauce” \ -e COOL_ENV_VAR_FROM_SERVER
  13. Use Case For TODAY Test/Build Infrastructure! • CI pulls/runs the

    same docker images that devs use locally • Self-Service CI- No more waiting on ops • Builds can do crazy destructive things in containers, who cares!
  14. Trends • OS independent Containerization APIs ◦ Warden -> Garden

    + Garden-Linux ◦ Docker’s libcontainer • Thin, Per-Application Containers • IAAS/PAAS support for Containerization • Container-native clouds ◦ Kubernetes, CoreOS, Lattice