Container Fundamentals
Containers package an application with its dependencies into an isolated unit that runs consistently across environments. They use OS-level virtualization — namespaces and cgroups on Linux — to provide process isolation without the overhead of full virtual machines.
itVirtualization, containers, and orchestration | OpenSkills.info
Course pathWalk it in order
Look it upDip in anytime
Go furtherLeaves this page
Don't Panic
Don't Panic — Container Fundamentals
A container is not a small virtual machine. It is an ordinary Linux process that the kernel has been persuaded to lie to about what exists.
Namespaces decide what that process is allowed to perceive — which other processes, which filesystems, which network interfaces, which hostname.
Cgroups, short for control groups, decide how much CPU and memory it may consume. Nothing is emulated: the kernel is the host's, shared with every other container on the machine.
That single fact settles most of the questions people arrive with. Why containers start faster than virtual machines: nothing boots. Why one host holds so many more: no guest operating system each. And why the two are not interchangeable as security boundaries — a kernel bug or one careless flag undoes this kind of isolation, while a virtual machine's boundary is drawn somewhere harder to erase.
Four nouns are worth keeping apart, because most early confusion lives in the gaps between them. An image is a read-only bundle: every file the program needs, plus the command that starts it. A registry hands images out. A runtime unpacks one and starts the process named in it. A container is that running process with its restricted view.
One image yields many containers, each with a writable layer that vanishes with it. Anything meant to survive goes into a volume, on purpose rather than by luck.
Get identity right early. A digest names exact content, so changing one byte
makes it a different digest, whereas a tag is a movable label — 2.4 may point
elsewhere next month and latest certainly will. Pin anything that matters to a
digest, and never put a secret in an image, since deleting it in a later build
step does not remove it from the earlier layer.
The surprise most people meet in production is signals. A container's main
process runs as PID 1, and the kernel delivers a signal to PID 1 only if
that process installed a handler for it. An application that never handles
SIGTERM — the polite request to shut down — therefore never receives one.
The runtime waits out the grace period, sends SIGKILL, which cannot be caught,
and every deploy quietly severs requests still in flight while looking like a
normal restart on every dashboard. Install a handler, or run a minimal init
program as PID 1. That is what "a process with a restricted view" costs the
moment it is forgotten.
One more, about where security attention goes. A scanner counts known vulnerabilities in packages the running process largely never touches, and that count is visible, comparable and satisfying to reduce, so it absorbs the budget. The things that genuinely set the blast radius carry no score: a mounted runtime socket, a privilege added in a hurry, a writable host path, a credential with more reach than the job needs. Counting those is far shorter work and a much better predictor of what happens after one application is compromised.
Start with the Intro for the model whole. Commands and the hardening baseline are on the Cheatsheet. Field Notes explains what a minimal base image costs at three in the morning.
Where this skill leads
Relevant careers
See how this topic contributes to broader role-level skill maps.
Sources
- https://specs.opencontainers.org/image-spec/
Supports
- OCI image structure, including manifests, indexes, configuration, descriptors, and filesystem layers
- Content-addressable image components and interoperability goals
- https://specs.opencontainers.org/runtime-spec/principles/
Supports
- Standard container and runtime model
- Portable runtime bundles and lifecycle principles
- https://github.com/opencontainers/runtime-spec/blob/main/runtime.md
Supports
- Container lifecycle and runtime operations
- Relationship between container state and the running process
- https://docs.docker.com/get-started/docker-overview/
Supports
- Docker image, container, registry, client, and daemon roles
- Container writable layer, networking, and removal behavior
- Linux namespaces as an isolation mechanism
- https://docs.docker.com/get-started/docker-concepts/the-basics/what-is-a-container/
Supports
- Containers as isolated processes
- Containers sharing a kernel compared with virtual machines using guest kernels
- https://docs.docker.com/get-started/docker-concepts/the-basics/what-is-a-registry/
Supports
- Registry and repository roles
- Build, tag, push, and pull workflow
- https://docs.docker.com/get-started/docker-concepts/building-images/build-tag-and-publish-an-image/
Supports
- Image reference structure and tag behavior
- Build, tagging, and publishing workflow
- https://docs.docker.com/get-started/docker-concepts/running-containers/persisting-container-data/
Supports
- Writable-layer ephemerality
- Volumes persisting data beyond one container lifecycle
- https://man7.org/linux/man-pages/man7/namespaces.7.html
Supports
- Namespace purpose and resource views
- Namespace types used to implement containers
- https://docs.kernel.org/admin-guide/cgroup-v2.html
Supports
- Cgroup hierarchy, process organization, controllers, and cgroup namespaces
- https://docs.docker.com/engine/security/
Supports
- Linux capabilities and reduced container privileges
- Security effects of host sharing and daemon authority
- https://docs.docker.com/engine/security/rootless/
Supports
- Rootless daemon and container execution in a user namespace
- Rootless mode as mitigation for daemon and runtime vulnerabilities
- https://csrc.nist.gov/pubs/sp/800/190/final
Supports
- Containers as operating-system virtualization plus application packaging
- Risks and recommendations across images, registries, orchestrators, containers, and hosts
- https://docs.docker.com/guides/lab-container-getting-started/
Supports
- Hands-on sequence for running containers, building images, observing isolation, and publishing
- https://www.freebsd.org/releases/4.0R/notes/
Supports
- FreeBSD 4.0 added jail(2) and jail(8) for secure process execution environments
- https://www.oracle.com/us/support/library/lifetime-support-hardware-301321.pdf
Supports
- Solaris 10 general availability in January 2005
- https://docs.oracle.com/cd/E23824_01/html/821-1460/gentextid-16717.html
Supports
- Solaris 10 Zones as an operating-system virtualization environment
- https://www.man7.org/linux/man-pages/man7/cgroups.7.html
Supports
- Initial cgroups implementation in Linux 2.6.24 and resource-control role
- https://linuxcontainers.org/fr/lxc/news/2018_03_27_21_03.html
Supports
- LXC application containers have used a minimal init system since the first release in 2008
- https://www.docker.com/blog/docker-nine-years-young/
Supports
- Docker was first publicly demonstrated on March 15, 2013
- https://www.linuxfoundation.org/press/press-release/open-container-initiative-oci-releases-v1-0-of-container-standards
Supports
- OCI formed in June 2015 and released runtime and image specifications v1.0 on July 19, 2017
- https://opencontainers.org/release-notices/overview/
Supports
- OCI Distribution Specification v1.0.0 release notice dated May 5, 2021
- https://www.cncf.io/announcements/2019/02/28/cncf-announces-containerd-graduation/
Supports
- containerd graduated from CNCF on February 28, 2019 and manages a host container lifecycle
- https://docs.docker.com/engine/
Supports
- Docker Engine architecture and management of images, containers, networks, and volumes
- https://docs.podman.io/en/latest/markdown/podman.1.html
Supports
- Podman as a daemonless engine for pods, containers, and images, including rootless operation
- https://containerd.io/docs/main/
Supports
- containerd image transfer, storage, execution, supervision, storage, and network lifecycle responsibilities
- https://linuxcontainers.org/lxc/introduction/
Supports
- LXC as a userspace interface for Linux kernel containment features
- https://docs.docker.com/docker-hub/
Supports
- Docker Hub registry workflows for finding, sharing, and managing container images
- https://docs.docker.com/reference/cli/docker/image/build/
Supports
- Building a tagged local image from a Dockerfile and build context
- https://docs.docker.com/reference/cli/docker/container/run/
Supports
- Detached named containers and loopback-only port publishing
- Read-only root filesystems, tmpfs mounts, and memory and CPU limits
- https://docs.docker.com/reference/cli/docker/inspect/
Supports
- Formatted container state and published-port inspection
- https://docs.docker.com/reference/cli/docker/container/logs/
Supports
- Retrieving logs available from a container
- https://docs.docker.com/reference/cli/docker/container/rm/
Supports
- Removing a stopped named container
- https://docs.docker.com/reference/cli/docker/image/rm/
Supports
- Removing a local image tag after no containers use it
