Skip to content

Container

A container is an isolated, portable unit of software that packages an application with its dependencies, sharing the host OS kernel while isolating the filesystem, processes and network.

Definition

What it is

A container is not a virtual machine. A VM virtualizes hardware (via a hypervisor) and runs its own kernel; a container virtualizes the operating system, sharing the host kernel and isolating only userspace. That difference is why a container starts in milliseconds and a VM in minutes.

Scope note. "Container" is used across three domains: OS-level containers (LXC, Docker, Podman), application containers (Java EE, .NET), and shipping containers (logistics). This entry covers OS-level containers — the ones used in modern software deployment.

Why it matters

A binary compiled against glibc 2.31 on Ubuntu 20.04 might not run on Alpine's musl libc. A Python script with pip install pandas might fail with a different numpy version. A container pins all of that: same OS, same libraries, same versions, from laptop to production. It is the end of configuration drift at the runtime layer.

Container vs virtual machine vs bare metal

Aspect

Container

Virtual machine

Bare metal

Isolation

Process-level

Hardware-level

None (one OS)

Startup time

Milliseconds

Minutes

Seconds to boot

Kernel

Shared with host

Own kernel

Own kernel

Density

Hundreds per host

Tens per host

One per machine

Security boundary

Weaker (kernel shared)

Stronger

Strongest

Best for

Microservices, CI

Legacy apps, multi-tenant

Databases, performance

The lifecycle of a container

graph LR
  I[Image] -->|docker run| C[Container running]
  C -->|SIGTERM| S[Graceful stop]
  S --> D[Container destroyed]
  C -->|crash| D
  style I fill:#E8F5E9
  style D fill:#FFEBEE

How to use containers well

Containers that behave

  1. One process per container

    A container with a process supervisor (systemd, supervisord) is fighting the model. Split into two containers.

  2. Keep images small

    alpine or distroless instead of ubuntu:latest. Smaller image = faster pull, fewer CVEs.

  3. Never run as root

    USER appuser in the Dockerfile. A root container shares the host's root kernel capabilities.

  4. Treat containers as ephemeral

    Data goes in volumes, logs go to stdout, state goes to a database. The container is disposable.

  5. Pin image digests

    image@sha256:... in production. Tags move; digests do not.

Common failures

Origin

A container is a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another.

— Docker, *What is a container?*, 2024
1979 · chroot (Unix V7)
2000 · FreeBSD jails
2006 · cgroups (Google)
2013 · Docker launch
2015 · OCI spec

Evidence

FAQ

Container vs VM?

A VM virtualizes hardware and runs its own kernel. A container virtualizes the OS and shares the host kernel.

Are containers secure?

Weaker isolation than VMs. For untrusted workloads, use gVisor, Kata Containers, or Firecracker.

Do containers persist data?

Only in volumes or bind mounts. A container's filesystem is ephemeral; delete it and data is gone.

Are containers portable across clouds?

Yes, if built to OCI spec. Kubernetes runs the same image on AWS, GCP, Azure, on-prem.

Container vs serverless?

A container is a long-running process; serverless runs a function per invocation with automatic scale-to-zero.

Connections

ContainervirtualizadeploymentDockerContainer Container Container Kubernetesvirtual-ma

● broader ● narrower ● related

Broader

  • virtualization
  • deployment

Related

Used in the garden

Sources

Etymology

Origin: metaphor

  • contain (verb): from Latin continēre, "to hold together"
  • -er (suffix): agent noun suffix

Semantic network

ContainervirtualizadeploymentDockerContainer Container Container Kubernetesvirtual-ma

● broader ● narrower ● related

Broader

  • virtualization
  • deployment

Related

Used in the garden

Sources