Use it to understand how containers differ from VMs and why they share the host kernel.
Containers Fundamentals
Container fundamentals: an image is a read-only layered filesystem plus metadata; a container is a running instance with its own writable layer, namespaces (pid, net, mnt, uts, ipc, user) and cgroup limits.
1. docker inspect <c> --format '{{.State.Pid}}' → host PID.
2. Namespaces: lsns -p <pid>.
3. Limits: docker stats --no-stream.
4. Rootless? docker info | grep -i rootless.
5. Image layers: docker history <image>.
image layers + writable layer → namespaces isolate → cgroups limit → process on the shared kernel
For Containers → Containers Fundamentals, continue with the first unproven Topic check: Pin exact host, runtime/hypervisor, object identity, source revision/image/definition and failing workload. If that boundary is healthy, advance to the adjacent check: Read back effective runtime state including process, namespace/resource or virtual-hardware boundaries. Preserve the same host/time/identity scope and rerun the original workload before accepting recovery.
Continue only after interpreting the current observation.Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Operational evidence path Verify boundary
host kernel → namespaces → cgroups → root filesystem → capabilities/security policy → container process → workload
Healthy evidence: processes have the expected namespace membership, cgroup controls, filesystem view and capabilities
Step 2 Verification and output interpretation Verify boundary
Verification chain. host kernel → namespaces → cgroups → root filesystem → capabilities/security policy → container process → workload
Step 3 Commands Verify boundary
docker info
podman info
ps -ef | grep containerd
Step 4 Failure modes and next checks Narrow the fault
Suspicious evidence: a process appears containerized but shares unintended namespaces/resources or depends on host state unexpectedly
Step 5 Common mistakes Narrow the fault
- Assuming containers are VMs (shared kernel).
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
Containers share the host kernel — kernel features and vulnerabilities affect them. Rootless containers (Podman, rootless Docker) reduce risk. Limits (--memory, --cpus) protect the host.
lsns -p <pid>— namespaces of a processdocker ps -a / podman ps -a— containers and statedocker logs <c>— container outputdocker inspect <c>— configuration, mounts, networkdocker info— engine, storage driver, cgroup version
ReferenceImportant terms & boundaries5 sections · depth on demand
What this shows and what it does not
The boundary is effective kernel isolation and resource control for the exact process set, not the presence of a container name or image.
In depth
Images, layers and the writable container layer
Container images are built from layers. Understanding them explains build speed, image size, and why container data disappears. Docker's documentation on image layers explains:
- Every Dockerfile instruction that changes files produces one layer, which never changes after it's created.
- Layers are stored by a digest of their contents, so identical layers are stored once and shared between images.
- A running container adds a thin writable layer on top. Changes, including changes to files that came from the image, land in that layer.
- Removing the container deletes its writable layer, and the image stays unchanged.
- The build cache reuses unchanged steps. A step reruns when it or its inputs change, and every later step reruns with it.
Consequences in practice
| Behaviour | Why |
|---|---|
| Data written inside a container is lost on removal | It's in the writable layer; use volumes |
| Deleting a file in a later layer doesn't shrink the image | The earlier layer still contains it |
| Changing a line early in a Dockerfile rebuilds everything after it | The cache is invalidated from that step onwards |
| Many images on one host share base layers | Stored once by digest |
Ordering a Dockerfile for the cache
| Order | Content |
|---|---|
| 1 | Base image |
| 2 | System packages (changes rarely) |
| 3 | Dependency manifests (package.json, requirements.txt) |
| 4 | Install dependencies |
| 5 | Application source (changes often) |
Inspecting layers
host$ docker history --format '{{.Size}}\t{{.CreatedBy}}' report-api:1.4 | head -5
48.2MB RUN /bin/sh -c pip install -r requirements.txt
1.1kB COPY requirements.txt . # buildkit
212kB COPY . . # buildkit
host$ docker image inspect report-api:1.4 -f '{{len .RootFS.Layers}} layers'
9 layers
host$ docker system df
TYPE TOTAL ACTIVE SIZE RECLAIMABLE
Images 14 6 3.9GB 2.2GB (56%)
Containers 7 6 412MB 8MB (1%)
Local Volumes 5 4 6.1GB 0B (0%)
host$ docker container diff web1 | head -3
C /var/cache/nginx
A /var/cache/nginx/client_temp
Reading the history
In this image, the source code COPY comes before pip install. Every source change therefore reruns the 48 MB dependency installation. Copying requirements.txt and installing it before COPY . . keeps that layer cached. docker container diff lists what a running container changed in its writable layer (A for added, C for changed).
Documented example, not captured output.
How it works at runtime
Containers Fundamentals is part of Containers → Containers Fundamentals. Container fundamentals explains Linux containers as processes isolated primarily by namespaces and governed by cgroups, with layered filesystem and runtime metadata rather than hardware virtualization.
Topic-specific state model. Container fundamentals explains Linux containers as processes isolated primarily by namespaces and governed by cgroups, with layered filesystem and runtime metadata rather than hardware virtualization.
Quick reference
Containers are processes isolated with kernel features: namespaces (pid, net, mnt, uts, ipc, user, cgroup) give them their own view of the system, cgroups limit resources, capabilities/seccomp/LSMs restrict what they can do, and an image provides the root filesystem.
| Runtime layer | Examples |
|---|---|
| Engine/CLI | Docker, Podman, nerdctl |
| High-level runtime | containerd, CRI-O |
| Low-level runtime (OCI) | runc, crun, gVisor, Kata |
lsns # namespaces on the host
systemd-cgls | head
podman run --rm -it alpine sh -c 'cat /proc/1/cgroup; id'
Containers share the host kernel: kernel vulnerabilities and privileged containers break isolation.
Limits and how it fails
Primary failure point. The boundary is effective kernel isolation and resource control for the exact process set, not the presence of a container name or image.
Snapshot/image existence is not a verified backup.
ReferenceConfiguration & state1 section · depth on demand
Configuration, persistence and lifecycle
Distribution/platform context. Containers Fundamentals owns the Linux execution concepts; platform-specific lifecycle belongs to Docker or another runtime.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Containers → Containers Fundamentals. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://docs.docker.com/engine/ · confidence 94%What changed and what may be affected
Recent technical edits are separated from ordinary page timestamps. Relationship impact is advisory: it identifies nearby canonical references to review, not automatic breakage.
Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.
Quick lookup tables
Containers Fundamentals operational reference
Topic-specific lookup boundaries, proof limits and next-step Evidence for Containers Fundamentals.
| Lookup boundary | Topic-specific reference | Operational use |
|---|---|---|
| Scope / effective state | Container fundamentals explains Linux containers as processes isolated primarily by namespaces and governed by cgroups, with layered filesystem and runtime metadata rather than hardware virtualization. | Establish exactly what this Topic owns before crossing into another subsystem. |
| Fast verification | Pin host + object identity + source image/definition → verify host/runtime capability → read back effective process/namespace/cgroup or virtual-hardware state → verify storage/network attachments → verify guest/container readiness → repeat original workload + regression check. | Use the shortest evidence path first; a fast check is a boundary test, not blanket proof. |
| Verification chain | host kernel → namespaces → cgroups → root filesystem → capabilities/security policy → container process → workload | Trace requested/configured state through effective state to the observed workload result. |
| Failure boundary | The boundary is effective kernel isolation and resource control for the exact process set, not the presence of a container name or image. | Stop broad troubleshooting at the first boundary that is not supported by evidence. |
| Positive evidence | Correlated Linux container/virtualization evidence can establish this proof path: host kernel → namespaces → cgroups → root filesystem → capabilities/security policy → container process → workload | Use this observation only for the specific claim it actually supports. |
| Evidence limit | It does not independently prove unobserved clients, names, identities, routes, sessions, backends or time periods. The boundary is effective kernel isolation and resource control for the exact process set, not the presence of a container name or image. | Do not promote a local success signal into end-to-end or adjacent-dependency proof. |
| Next troubleshooting check | Continue from the first unproven runtime boundary, capture adjacent host/object/resource/attachment evidence, make only the demonstrated persistent change, then repeat the original workload plus a regression check. | Continue to the next unresolved boundary while preserving the original test condition. |
Containers Fundamentals · operational reference
Compact Linux state, persistence, verification and boundary reference for fast lookup.
| Reference boundary | Containers Fundamentals |
|---|---|
| Topic path | Containers → Containers Fundamentals |
| Runtime state | Container fundamentals explains Linux containers as processes isolated primarily by namespaces and governed by cgroups, with layered filesystem and runtime metadata rather than hardware virtualization. |
| Fast checks | - Pin exact host, runtime/hypervisor, object identity, source revision/image/definition and failing workload. - Read back effective runtime state including process, namespace/resource or virtual-hardware boundaries. - Trace storage and network attachments plus readiness from the real client or dependent workload path. - Apply the smallest persistent change, then repeat the original workload and an adjacent regression check. |
| Verification chain | host kernel → namespaces → cgroups → root filesystem → capabilities/security policy → container process → workload Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return/regression → explicit Evidence boundary. |
| Failure boundary | The boundary is effective kernel isolation and resource control for the exact process set, not the presence of a container name or image. Boundary chain: process/context → userspace configuration → kernel subsystem/resource → device/network/filesystem dependency → effective state → original workload. |
| Persistence rule | Prove which configuration source owns the state, then prove that the running consumer loaded or generated the intended state. |