Docker
Docker
• Uses
2
What is Docker?
Docker is an open-source project that
automates the deployment
of applications inside software
containers, by providing an additional
layer of abstraction and automation
of operating system–level
virtualization on Linux.
[Source: en.wikipedia.org]
3
Docker: Name
[www.docker.com]
4
Containers
• Virtualize the OS, not the full machine
• Container sits on host OS kernel, and some shared
binaries
– These are read only
• Sharing OS resources significantly reduces footprint
– Containers are lightweight – megabytes in size
• Smaller snapshots, can have many more on one physical machine
– VMs are an order of magnitude or more larger
• Take longer to launch, etc…
5
Docker vs. Virtual Machine
Source: https://www.docker.com/whatisdocker/
6
Performance comparison
Size comparison
9
Additional discussion points
• Name spaces, and unix jail
• VMs include a separate OS image, adding
complexity to all stages of development lifecycle
– Limits portability between clouds and data centers
• Performance isolation:
– Unix cgroups can provide isolation for CPU, memory,
I/O and network
10
Docker Technology
• libvirt: Platform Virtualization
• LXC (LinuX Containers): Multiple
isolated Linux systems (containers) on
a single host
• Layered File System
[Source: https://docs.docker.com/terms/layer/]
11
Docker History
• 2013-03: Releases as Open Source
• 2013-09: Red Hat collaboration
(Fedora, RHEL, OpenShift)
• 2014-03: 34th most starred GitHub
project
• 2014-05: JAX Innovation Award (most
innovative open technology)
12
Terminology - Image
• Persisted snapshot that can be run
– images: List all local images
– run: Create a container from an image and execute a
command in it
– tag: Tag an image
– pull: Download image from repository
– rmi: Delete a local image
• This will also remove intermediate images if no longer used
13
Terminology - Container
• Runnable instance of an image
– ps: List all running containers
– ps –a: List all containers (incl. stopped)
– top: Display processes of a container
– start: Start a stopped container
– stop: Stop a running container
– pause: Pause all processes within a container
– rm: Delete a container
– commit: Create an image from a container
14
Image vs. Container
Base Image run Container
ubuntu:latest cid1
15
Dockerfile
• Create images automatically using a
build script: «Dockerfile»
• Can be versioned in a version control
system like Git or SVN, along with all
dependencies
• Docker Hub can automatically build
images based on dockerfiles on Github
16
Docker Use Cases
• Development Environment
• Environments for Integration Tests
• Quick evaluation of software
• Microservices
• Multi-Tenancy
• Unified execution environment (dev test
prod (local, VM, cloud, ...)
17
Use case: scientific reproducibility
• Dependency hell
– Less than 50% of software could be built or installed
– Difficult to reproduce computational environment
• Imprecise documentation
– Difficult to figure out how to install
• Code rot
– Software dependencies change, affecting results
• Barriers to adoption and reuse
– Difficulty to coordinate build tools/package managers
18
Use case: scientific reproducibility
• Dependency hell
– Docker! Container includes everything!
• Imprecise documentation
– Dockerfiles keep record of dependencies
• Code rot
– versioning
• Barriers to adoption and reuse
– Argues that docker provides features to help with that
19