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
One process per container
A container with a process supervisor (systemd, supervisord) is fighting the model. Split into two containers.
Keep images small
alpineordistrolessinstead ofubuntu:latest. Smaller image = faster pull, fewer CVEs.Never run as root
USER appuserin the Dockerfile. A root container shares the host's root kernel capabilities.Treat containers as ephemeral
Data goes in volumes, logs go to stdout, state goes to a database. The container is disposable.
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
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
- docker
- container-image
- container-runtime
- container-registry
- kubernetes
- virtualization
● broader ● narrower ● related
Broader
virtualizationdeployment
Related
Used in the garden
- Nginx Mastery: Host Multiple Apps with One Server, Conquer LatAm Tech Costs (2×)
- Core Web Vitals Optimization: The Complete Technical Guide (2×)
- Serverless Savings: Cut Cloud Costs by 40% with Elegant Patterns (1×)
- 10 Obscure Web Artifacts: Digital Oddities & Surreal Nodes (1×)
- ProcessWire vs WordPress: The Unseen Power Play for Elite Custom Web Apps (1×)
- The Therapist Who Branded Her Safety (1×)
- Web Analytics and Data-Driven Marketing: The Complete Guide (1×)
Sources
Docker (2024). What is a container? https://www.docker.com/resources/what-container/
Open Container Initiative (2024). OCI Runtime Specification. https://github.com/opencontainers/runtime-spec
Microsoft Learn (2024). Containers vs virtual machines. https://learn.microsoft.com/en-us/virtualization/windowscontainers/about/containers-vs-vm
Kleppmann, M. (2017). Designing Data-Intensive Applications, Chapter 10. https://dataintensive.net/
Etymology
Origin: metaphor
contain(verb): from Latin continēre, "to hold together"-er(suffix): agent noun suffix
Semantic network
● broader ● narrower ● related
Broader
virtualizationdeployment
Related
Used in the garden
- Nginx Mastery: Host Multiple Apps with One Server, Conquer LatAm Tech Costs (2×)
- Core Web Vitals Optimization: The Complete Technical Guide (2×)
- Serverless Savings: Cut Cloud Costs by 40% with Elegant Patterns (1×)
- 10 Obscure Web Artifacts: Digital Oddities & Surreal Nodes (1×)
- ProcessWire vs WordPress: The Unseen Power Play for Elite Custom Web Apps (1×)
- The Therapist Who Branded Her Safety (1×)
- Web Analytics and Data-Driven Marketing: The Complete Guide (1×)
Sources
Docker (2024). What is a container? https://www.docker.com/resources/what-container/
Open Container Initiative (2024). OCI Runtime Specification. https://github.com/opencontainers/runtime-spec
Microsoft Learn (2024). Containers vs virtual machines. https://learn.microsoft.com/en-us/virtualization/windowscontainers/about/containers-vs-vm