
Rensselaer Center for Open Source
By: Seve, Joey, and Andy
Tech Talk: Docker Basics

What is Docker?

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.

Technical Details
Why
-
Run everywhere
- Regardless of kernel version
- Regardless of host distro.
- Physical or virtual, cloud or not
- Container and host architecture must match...
-
Run anything
- If it can run on the host, it can run in the container
- If it can run on a Linux kernel, it can run in the container
What
-
High level: a lightweight VM
- Own process space
- Own network interface
- Can run stuff as root
- Can have its own /sbin/init (different from host)
-
Low Level: Chroot on steroids
- Can also not have its own /sbin/init
- Container = isolated processes
- Share kernel with host

Why Developers Care
- A clean, safe, hygienic, portable runtime environment for your app.
- No worries about missing dependencies, packages and other pain points during subsequent deployments.
- Run each app in its own isolated container, so you can run various versions of libraries and other dependencies for each app without worrying.
- Automate testing, integration, packaging... anything you can script.
- Reduce/eliminate concerns about compatibility on different platforms.
- Cheap, zero-penalty containers to deploy services. A VM without the overhead of a VM. Instant replay and reset of image snapshots.
- Makes the entire lifecycle more efficient, consistent, and repeatable

VMs vs Containers


Why are Docker Containers Lightweight?


Container vs Image
Image
An image is an inert snapshot of a container.
When run (with a docker run command) it becomes a container.
As images can be quite heavy they are designed to be composed of layers of other images which allows them to minimize the image weight, and those layers can be reused between images.
Images are stored (mainly) on Docker Hub.

Container vs Image
Image
An image is built from a Dockerfile. A file describing how the image is supposed to behave, what it extends from, ...
docker images command lists all local images :

Container vs Image
Container
Programmatically speaking, if an image is a class, then a container would be an instance of this class.
So, you can launch multiple containers for the same image (multiple instances).
docker ps command lists all running containers :

Demo
Time to test out Docker!

Orchestration
Solutions?
- Put commands in a README ?
- Write a bash script to start containers ?
What if we want to run multiple containers at once

Orchestration
Docker compose works by putting a single yaml file in your project.
Docker compose works by putting a single yaml file in your project
deck
By Joseph Lee
deck
- 762