Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Contents
• Introduction to Docker, Containers, and the Matrix from Hell
• What is Docker?
• What are containers?
• Why use containers?
• Prerequisites
• Docker Futures
• Advanced topics: Networking, Data
What is Docker?
• VMs are great at providing full process isolation for applications: there are
very few ways a problem in the host operating system can affect the
software running in the guest operating system, and vice-versa. But this
isolation comes at great cost — the computational overhead spent
virtualizing hardware for a guest OS to use is substantial.
• From an operations standpoint, apart from portability containers also give more granular control over
resources giving your infrastructure improved efficiency which can result in better utilization of your
compute resources.
Prerequisites
• There are no specific skills needed for this tutorial beyond a basic
comfort with the command line and using a text editor. Prior
experience in developing web applications will be helpful but is not
required. As we proceed further along the tutorial, we'll make use of
a few cloud services. If you're interested in following along, please
create an account on each of these websites:
WHY WHAT
• Run everywhere • High Level—It’s a lightweight VM
• Regardless of kernel version • Own process space
(2.6.32+) • Own network interface
• Regardless of host distro • Can run stuff as root
• Physical or virtual, cloud or not • Can have its own /sbin/init (different
• Container and host architecture must from host)
match* • <<machine container>>
• Run anything
• If it can run on the host, it can run in • Low Level—It’s chroot on steroids
the container • Can also not have its own /sbin/init
• i.e. if it can run on a Linux kernel, it • Container=isolated processes
can run • Share kernel with host
• No device emulation (neither HVM
nor PV) from host)
• <<application container>>
Containers vs. VMs
App App App Containers are isolated,
A A’ B
but share OS and, where
Bins/ Bins/ Bins/
Libs Libs Libs
appropriate, bins/libraries
VM …result is significantly faster deployment,
Guest Guest much less overhead, easier migration,
OS OS faster restart
Guest Guest Guest
OS OS OS
App B’
App B’
App A’
App B’
App A
App B
Docker
Container
Hypervisor (Type 2) Bins/Libs Bins/Libs
Host OS Host OS
Server Server
Why are Docker containers lightweight?
VMs Containers
App
App Δ
App App App
App
A’ A A
A A
Bins/
Bins/
Bins/ Bins/ Bins/
Libs Libs Libs Libs
Guest
Guest Guest OS
Guest
OS OS OS
Original App Copy of Modified App
(No OS to take App
up space, resources, No OS. Can Copy on write
or require restart) Share bins/libs capabilities allow
us to only save the diffs
VMs Between container A
Every app, every copy of an and container
app, and every slight modification A’
of the app requires a new virtual server
What are the basics of the Docker system?
Push
Container A
Docker
Container
Image
Registry
Search
Pull
Build Run
Dockerfile
For
A
Container B
Container A
Container C
Docker
Source
Code
Docker Engine
Repository
Host 1 OS (Linux)
Host 2 OS (Linux)
Changes and Updates
App Push
App Δ
A
Docker
Bins/ Container
Bins/
Libs Image
Registry
App Δ
Container Mod A’ Mod A’’
Update
Image
Bins/
App App
A’’ A
Bins/ Bins/
Bins/
Libs Libs
• Futures:
• See Pipework (Upstream) : Software-Defined Networking for Linux Containers (https://github.com/jpetazzo/pipework)
• Certain pipework concepts will move from upstream to part of core Docker
• Additional capabilities come with libvirt support in 0.8-0.9 timeframe
www.docker.com