Introduction to Containers

Collin Dewey

02/20/2025

Introduction to Containers

bg right:40% 90%

Docker Engine Logo


Containers versus Virtual Machines

ContainersVirtual Machines
IsolationGoodGreat
KernelSame as Host OSHas own Kernel
PerformanceNative PerformanceEmulated/Virtualized Hardware
Resource UsageSmall, DynamicLarge, Preallocated Resources
Ease of useEasy to setup & changeHarder to setup, easy to change
EnvironmentDeterministicDeviates (Updates, Configuration)
QuantityLarge AmountLimited Amount

Containers are usually used for one application or service. Virtual Machines handle many applications or services.


How are containers setup on Linux?

Linux features for resource restrictions and isolations 1


How are containers setup on Windows?

Windows features for resource restrictions and isolations 2

Linux containers can be run through the Windows Subsystem for Linux. This means you will lose the raw performance advantages of containers.


Open Container Initiative (OCI)

bg fit right:33% 80%

Open Container Initiative Logo

Specification for how containers images are formatted and run. Used by…


Linux Containers (LXC)

bg fit right:40% 70%

Linux Containers LXC Logo

What if you want the permanence of a Virtual Machine but the performance of a Container?


Creating an OCI Container Image

What makes a container

Containers need to contain all Linux system files wanted by the software being used within the containers, such as libraries and dependencies.

Generating an Image

OCI Images are created most often through using a Dockerfile. This file contains the stages to take a base OS, and transform it into your desired usecase. Optionally, there may be a build stage that doesn’t get pushed to the resulting image, for when software needs to be built. These images are stored in layers, so containers can build on other containers, and share mutual data.


Docker Container Registry / Github Container Registry

Containers can be stored locally, or uploaded to the internet for other people to download.


Container Security

System Calls

Containers share the same kernel as the host, therefore syscalls are restricted through namespaces and seccomp. List namespaces with lsns.

gVisor

Google wasn’t happy with that and made their own sandbox which sits between the container and the kernel, limiting syscalls.


Image Security

When using other people’s containers, you have to trust whoever made them to not embed malware.

Some containers were built a long time ago and some software may have vulnerabilities.

Blindly updating images can be a problem if the container registry uploader’s account is compromised


NIST’s Application Container Security Guide 3


Container Orchestration Software

Handles

Kubernetes, Docker Swarm, Rancher, Portainer, Nomad, etc…


Compose

See Compose Presentation