Pcornel
Linux · Containers

Containers Fundamentals

Cheat sheet · https://pcornel.dk/topic.php?topic=2889

Back to the Topic

Answer

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.

Remember

Containers share the host kernel — kernel features and vulnerabilities affect them. Rootless containers (Podman, rootless Docker) reduce risk. Limits (--memory, --cpus) protect the host.

First checks

  • lsns -p <pid> — namespaces of a process
  • docker ps -a / podman ps -a — containers and state
  • docker logs <c> — container output
  • docker inspect <c> — configuration, mounts, network
  • docker info — engine, storage driver, cgroup version

Commands

docker container diff

Verify in this order

image layers + writable layer → namespaces isolate → cgroups limit → process on the shared kernel

Where it usually breaks

First mismatch in hardware/kernel capability → scheduler/mm/device → cgroup/namespace → process/thread → service/runtime → workload behavior/counters; preserve identity/native diagnostic/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=2889

Confirmation

Confirm action

Continue?