Track
Docker & Containers lessons
48 short lessons on Docker & Containers. Each one starts from a real situation, shows how it works, and ends with a quiz. Free to read.
All 48 lessons
- Containers vs virtual machinesBeginner · 5 min
Compare containers and virtual machines, and learn how isolation and resource sharing affect their security and operation.
- docker run, ps, logs, exec and stopBeginner · 5 min
Five commands cover most container tickets: start it, see it, read what it said, get inside it, stop it. Learn what each one touches and what it leaves behind.
- Images, tags and registriesBeginner · 5 min
An image is a read-only package; a container is one running copy of it. Tags are movable labels on images, which is why 'it worked yesterday with latest' is a real bug.
- Writing a Dockerfile: FROM, COPY, RUN, CMDBeginner · 6 min
A Dockerfile is a short recipe that turns your code into an image. Five instructions cover most files, and the hard part is knowing which ones run when you build and…
- Volumes, bind mounts and environment variablesBeginner · 6 min
Removing a container deletes its writable layer; data in separate volumes or bind mounts can remain. Volumes keep data alive past the container, and environment…
- Why did my container exit? Exit codes 0, 1, 137 and 143Beginner · 5 min
Every stopped container leaves a number behind. Read it, and a mystery restart loop becomes one of three or four causes you can test in a minute.
- PID 1, signal forwarding and why docker stop takes 10 secondsBeginner · 5 min
docker stop waits exactly ten seconds and then kills your service. The ten seconds are not Docker being slow: your program is PID 1, and the kernel treats PID 1…
- Debugging a running container: exec, logs, inspect, nsenterBeginner · 5 min
The container is Up, the health check is green and users still get errors. Debugging it means asking the container, the kernel and the host in a fixed order, and having…
- Layer caching: order your Dockerfile for fast buildsBeginner · 5 min
A Node.js service rebuilds in over four minutes after every one-line edit because the dependency install runs again. The fix is moving two lines, and it works only once…
- Multi-stage builds and small imagesBeginner · 5 min
A Go service that compiles to a 14 MB binary ships as a 1.1 GB image, because the compiler came along for the ride. Multi-stage builds leave the toolbox behind.
- Tags vs digests: reproducible buildsBeginner · 5 min
Friday's build passed and Monday's failed with the same Dockerfile and the same commit. A tag is a label someone can move, and a digest is a fingerprint no one can.
- OCI image manifestBeginner · 4 min
OCI image manifest describes layers configuration and platform.
- Namespaces: what a container can seeBeginner · 5 min
Two containers on one host both say they are PID 1, both listen on port 80 and both call themselves app. Nothing is faked: each one is looking at its own private copy…
- Run as non-root and drop capabilitiesBeginner · 5 min
Root inside a container is still root as far as the kernel's permission checks go. Two changes cut that power down: run as a normal user and drop the capabilities you…
- SeccompBeginner · 4 min
Seccomp filters available system calls.
- Rootless containersBeginner · 4 min
Rootless containers run daemon or containers without host root.
- CPU limits and throttlingBeginner · 5 min
A container shows 20% average CPU and still freezes for tenth-of-a-second stretches. The limit does not slow the CPU down, it switches the container off for part of…
- Memory limits and OOMKilledBeginner · 5 min
A worker restarts a few times a day and every log looks clean. The kernel killed it, left a flag and a counter behind, and neither shows up in the application logs.
- PID limitBeginner · 4 min
PID limit caps tasks in the container cgroup.
- HEALTHCHECK and restart policiesBeginner · 5 min
A service that needs 100 seconds to start gets labelled unhealthy at second 90. The health check defaults are for fast apps, and an unhealthy label restarts nothing by…
- Bridge networking and container DNSBeginner · 5 min
Two containers sit on the same host, both running, and one cannot find the other by name. The default network has no name lookup, and the fix takes one command.
- Publishing ports with -p, and the database you exposed by accidentBeginner · 5 min
Docker port publishing can expose a container service through the host. One missing address in -p turns a local test database into one reachable from the internet.
- Compose: run a multi-container appBeginner · 5 min
A README with fourteen docker run commands, in the right order, with the right flags, is how a new teammate loses a morning. A 25-line file replaces it.
- Layered filesystemBeginner · 4 min
Explain how image layers and copy-on-write work, and why a deleted file still takes space in an earlier layer and why copy order affects build caching.
- BuildKit cache mountsIntermediate · 4 min
Explain how BuildKit cache mounts keep package caches across builds without storing them in the image, and where that cache lives, including on a fresh CI runner.
- Multi stage buildsIntermediate · 4 min
Explain how multi-stage Dockerfiles keep build tools out of the final image, how COPY --from chooses what the runtime stage receives, and when a broad copy undoes it.
- Distroless imagesIntermediate · 4 min
Explain what distroless base images contain, what they leave out, and how to debug and scan them safely when the running container has no shell.
- Container PID 1Intermediate · 4 min
Explain why PID 1 in a container must reap orphans and receive signals, and how --init and the exec form fix a stop that always takes ten seconds.
- Signal forwardingIntermediate · 4 min
Explain how the stop signal reaches a container's app, and why exec form and a program that handles SIGTERM are needed for a clean shutdown.
- Container capabilitiesIntermediate · 4 min
Explain how Linux capabilities split root privilege, and how to drop all capabilities and add back only the one a container needs, checked against its process status…
- User namespace remapIntermediate · 4 min
Explain how user namespace remapping maps container root to an unprivileged host user, and what that means for existing volumes and images before you enable it.
- seccomp profilesIntermediate · 5 min
Explain how a seccomp profile filters system calls, and how to test whether a seccomp block, rather than a missing capability, causes an EPERM error.
- AppArmor and SELinuxAdvanced · 4 min
Explain how AppArmor and SELinux add access checks on top of file modes, and how to read a denial and relabel a bind mount safely.
- Cgroups resource limitsAdvanced · 4 min
Explain how Docker resource flags become cgroup files that the kernel enforces, and how to read the limit a container really has on a live host.
- OOM exit codesAdvanced · 4 min
Explain what exit code 137 and the OOMKilled flag show, and separate a kernel memory kill from a crash or a manual stop before changing any limit.
- Container networkingAdvanced · 4 min
Explain why each container has its own network view, how a veth pair links it to the host, and why localhost inside one container cannot reach another.
- Bridge interfacesAdvanced · 4 min
Explain what docker0 and user-defined bridges are, how veth pairs attach containers to them, and where host routes and firewall rules can break container traffic.
- DNS in containersAdvanced · 4 min
Explain how containers find other containers by name through embedded DNS on user-defined networks, and why the default bridge and loopback resolvers behave differently…
- Registry authenticationAdvanced · 4 min
Explain how docker login stores registry credentials per host, why a rotated token breaks some runners, and how to pass a token without leaving it in shell history.
- Image signingAdvanced · 4 min
Explain what Docker Content Trust checks at pull time, why a valid signature is not proof of safety, and why deploys should record a digest.
- SBOM generationAdvanced · 4 min
Explain what an SBOM lists, how BuildKit attaches one to an image as an SPDX attestation, and how to check that it describes the image you deploy.
- Vulnerability scanningAdvanced · 4 min
Explain how a vulnerability scanner matches an image's SBOM against a database, why a clean scan is not proof of safety, and how to read findings with their fixes.
- Volumes and bind mountsAdvanced · 4 min
Explain why a container's writable layer is lost with the container, how named volumes and bind mounts keep data, and how to choose between them.
- Container storage driversAdvanced · 4 min
Explain what a storage driver does with image layers and the writable layer, why copy-on-write makes some writes slow, and how to read disk use per node.
- Compose deploymentsAdvanced · 4 min
Explain how a Compose file declares services, startup order and healthchecks, and why depends_on alone waits only for a running container, not a ready one.
- Debugging a containerAdvanced · 4 min
Explain how to read a container's recorded state and logs, why exec needs a shell and a running process, and how a debug container can share namespaces.
- OOM exit codes: failure analysisAdvanced · 4 min
Explain how cgroup event counters and the host kernel log show whether a container or the host caused an OOM kill, and how to keep the evidence.
- Container networking: operational verificationAdvanced · 4 min
Explain how to prove each hop of a container's network path, from the published port to the service name and the outside route, with checks that can run after every…