Docker
How containers actually isolate processes — cgroups, namespaces, and UnionFS layers, not just 'it's lighter than a VM'.
Interactive Question & Article Stream
Browse questions with quick answers, filter by level or domain, and expand full articles on demand in a continuous reading view.
Beginner Modules(0/17)
Containers vs. VMs: What the Kernel Actually Isolates
ArticleA junior engineer says "a container is just a lightweight VM." Explain precisely why this analogy is wrong, and describe what a container actually *is* at the process level on the host.
Images, layers, and the Dockerfile instruction order that matters
ArticleYou run `docker build` twice on the same Dockerfile with no changes and notice the second build finishes in under a second. Explain what mechanism makes this possible and what is actually being reused.
Docker Layer Caching: Why Unchanged Rebuilds Finish Instantly
ArticleYou run `docker build` twice on the same Dockerfile with no changes and notice the second build finishes in under a second. Explain what mechanism makes this possible and what is actually being reused.
Containers vs. VMs: Why the Lightweight VM Analogy Is Wrong
ArticleA junior engineer says "a container is just a lightweight VM." Explain precisely why this analogy is wrong, and describe what a container actually *is* at the process level on the host.
docker run, build, exec — the three commands you'll use daily
Q&A ChallengeA junior engineer says "a container is just a lightweight VM." Explain precisely why this analogy is wrong, and describe what a container actually *is* at the process level on the host.
Containers vs. VMs: Why 'Lightweight VM' Is the Wrong Mental Model
ArticleA junior engineer says "a container is just a lightweight VM." Explain precisely why this analogy is wrong, and describe what a container actually *is* at the process level on the host.
Docker Layer Caching: Why Unchanged Builds Finish Instantly
ArticleYou run `docker build` twice on the same Dockerfile with no changes and notice the second build finishes in under a second. Explain what mechanism makes this possible and what is actually being reused.
ENTRYPOINT vs. CMD: Why Removing CMD Changes Runtime Behavior
ArticleYour team's Dockerfile uses both `ENTRYPOINT` and `CMD`. A teammate wants to remove `CMD` because "it seems redundant." Explain why removing it would change the container's runtime behavior and give a scenario where this distinction matters operationally.
Bind Mounts vs. COPY: Why Dev Convenience Doesn't Belong in Production
ArticleA developer mounts their local project folder into a container with `-v` during development, but in the production Dockerfile they use `COPY`. Explain why these two approaches exist and why you would never rely on a bind mount in a production deployment.
Container Filesystem Lifecycle: Why Data Disappears Without Volumes
ArticleA container running a database is removed with `docker rm`, and the team is shocked their data disappeared. Diagnose what likely went wrong in their setup and explain the container filesystem lifecycle that caused this.
Docker Port Mapping: How a Packet Reaches Your Container
ArticleA service inside a container listens on port 8080, and it's exposed with `-p 80:8080`. Walk through what actually happens to a packet arriving at the host's port 80 to reach the process inside the container.
Alpine vs. Ubuntu Base Images: Trade-offs Beyond Image Size
ArticleTwo engineers build the same application — one from `ubuntu:latest`, another from `alpine`. Beyond image size, what practical engineering trade-offs should inform this base image decision?
Docker Logging Model: Why stdout/stderr, Not Log Files
ArticleA teammate adds application logging to a file inside the container instead of stdout/stderr, then complains `docker logs` shows nothing. Explain the underlying logging model Docker expects and why their approach breaks it.
Docker Build Context: Why an Untouched node_modules Folder Slows Builds
ArticleA build suddenly takes much longer after a teammate added a large `node_modules` folder to the project directory, even though it's never referenced in the Dockerfile. Explain what's happening and how to fix it.
Environment Variables in Docker: Configuring One Image for Many Environments
ArticleYour application needs different database URLs in staging versus production, but you want to use the exact same image in both. Explain the mechanism that makes this possible without rebuilding the image, and why baking config into the image is considered an anti-pattern.
Container Lifecycle and PID 1: Why Containers Exit When Their Main Process Stops
ArticleA container running a simple shell script exits immediately after starting, even though the script "runs forever" when tested locally. What container lifecycle rule explains this behavior?
Docker Image Tagging: Why the latest Tag Breaks Reproducible Deployments
ArticleYour team deploys using the `latest` tag and occasionally ends up with different code running on different hosts despite "not changing anything." Explain why tag-based deployment without immutable references is risky in production.
Intermediate Modules(0/12)
Multi-Stage Docker Builds: Shrinking Go Images by Discarding the Compiler Toolchain
ArticleYour Go application's final image is 900MB because it includes the full compiler toolchain. Design a multi-stage build that resolves this, and explain precisely what gets carried between stages and what gets discarded.
Docker Layer Caching: Why COPY Order Determines Build Speed
ArticleA Dockerfile does `COPY . .` before `RUN npm install`. Every single code change forces a full dependency reinstall during CI, adding 4 minutes per build. Explain the caching mechanic causing this and restructure the instructions to fix it.
BuildKit Cache Mounts: Persistent Dependency Caching Across Ephemeral CI Runners
ArticleEven after reordering Dockerfile instructions for cache-friendliness, your team's CI runners (ephemeral, ban `--cache-from` layer reuse) still reinstall dependencies every run. What BuildKit feature addresses this specific problem, and how does it differ from ordinary layer caching?
Default Bridge vs. User-Defined Bridge: Why Container Name Resolution Differs
ArticleTwo containers on the default `bridge` network can't resolve each other by container name, but two containers on a user-defined bridge network can. Explain the underlying difference in how Docker handles DNS resolution between these two network types.
Host Networking vs. Bridge Networking: The Latency Trade-Off Behind --network host
ArticleA latency-sensitive service performs noticeably better under `--network host` than the default bridge network. Explain the actual network path difference that causes this performance gap, and identify the operational trade-off the team is accepting by using host networking.
depends_on in Docker Compose: Why Container Startup Order Isn't Application Readiness
ArticleA `docker-compose.yml` uses `depends_on` to ensure the database container starts before the API container, but the API still crashes on startup trying to connect. Explain why `depends_on` alone doesn't solve this problem and what actually needs to happen.
UID Mapping in Docker: Why Bind-Mounted Files End Up Owned by Root
ArticleA container runs as root by default, and a file it writes to a bind-mounted volume ends up owned by `root` on the host, breaking the host user's ability to edit it. Explain the UID mapping reality behind this, and describe two distinct strategies to prevent it.
Running Containers as Non-Root: Dockerfile Changes and the Trade-Offs They Introduce
ArticleYour security team mandates that no production container may run as UID 0. Walk through what changes are required in the Dockerfile and what operational issues (port binding, file permissions, package installs) commonly break as a result — and how to resolve each.
Docker's Embedded DNS Resolver: Why External Hostname Lookups Intermittently Fail Under Load
ArticleA container intermittently fails to resolve an external hostname under load, though `curl` works fine most of the time. Explain how Docker's embedded DNS resolver works and a plausible root cause for intermittent resolution failures.
Docker Compose Health Checks: Reporting True Application Readiness, Not Just Process State
ArticleA Compose stack reports all containers as "running," yet the application is non-functional because the API started before the database finished initializing. Design a `HEALTHCHECK`-based solution and explain how it changes container state reporting versus a plain process check.
Docker Build Context Bloat: How .dockerignore Prevents Sending Unnecessary Files to the Daemon
ArticleYour CI logs show the build context being sent to the daemon is 1.2GB despite a small application. Explain the mechanism by which this bloat occurs and how `.dockerignore` interacts with the build process to prevent it.
Named Volumes Across Hosts: Why Local Volumes Don't Follow Rescheduled Containers
ArticleA team migrating from a single Docker host to a small Swarm/multi-host setup discovers that named volumes don't "follow" a rescheduled container to another node. Explain why this happens and what class of solution is required.
Advanced Modules(0/12)
Linux Namespaces: The Isolation Mechanisms Behind Every Container
ArticleExplain, namespace by namespace (PID, NET, MNT, UTS, IPC, USER), what specific kernel isolation each one provides to a container, and describe a real scenario where sharing one particular namespace between containers (e.g., `--pid=container:x`) is a deliberate and useful debugging technique.
cgroups Memory Accounting: Why OOM-Kills Happen Below the Limit
ArticleA container set with `--memory=512m` gets OOM-killed even though `docker stats` shows it using only 300MB of RSS at the time. Explain what other memory accounting cgroups tracks (page cache, kernel memory) that could explain this, and how you'd investigate.
OverlayFS Copy-Up: The Hidden Cost of Small-File Writes in Containers
ArticleA build suddenly takes much longer after a teammate added a large `node_modules` folder to the project directory, even though it's never referenced in the Dockerfile. Explain what's happening and how to fix it.
From docker run to runc: Tracing the Full Container Startup Chain
ArticleDiagram (in words) the full process chain from a `docker run` invocation down to the actual container process, explicitly naming the role of `dockerd`, `containerd`, `containerd-shim`, and `runc`, and explain why the shim's existence allows the Docker daemon to be restarted without killing running containers.
Linux Capabilities: The Least-Privilege Alternative to --privileged
ArticleA container needs to bind to a privileged port and adjust system time as part of its function, but your security policy forbids `--privileged`. Explain the capability-based alternative, name the specific capabilities required, and articulate why granular capability grants are architecturally superior to the privileged flag.
Rootless Docker: How User Namespace Remapping Blocks Host Root Escalation
ArticleYour application needs different database URLs in staging versus production, but you want to use the exact same image in both. Explain the mechanism that makes this possible without rebuilding the image, and why baking config into the image is considered an anti-pattern.
Docker Networking Internals: How Custom Bridges Rewrite iptables NAT and FILTER Rules
ArticleYou create a custom bridge network and notice new `iptables` chains and rules appear on the host without you touching `iptables` directly. Explain what Docker is doing to the NAT and FILTER tables to make inter-container and container-to-external routing work, and describe a scenario where a conflicting host firewall rule could silently break container connectivity.
VXLAN Overlay Networks: How Multi-Host Containers Communicate by IP
ArticleIn a multi-host overlay network (e.g., Swarm), two containers on different physical hosts communicate directly by container IP. Explain the encapsulation mechanism (VXLAN) that makes this possible at the packet level, and identify the MTU-related failure mode this commonly introduces.
OCI Image Manifest vs. Runtime Spec: From Pulled Image to Running Container
ArticleA container running a simple shell script exits immediately after starting, even though the script "runs forever" when tested locally. What container lifecycle rule explains this behavior?
CFS CPU Throttling: Why --cpus=2 Causes Latency Spikes Under 200% Usage
ArticleA service configured with `--cpus=2` shows periodic latency spikes even though average CPU usage sits well under 200%. Explain how CFS (Completely Fair Scheduler) quota-based throttling within a fixed period can cause this, and why average utilization metrics can be misleading here.
--pid=host: The Process Isolation Guarantee It Breaks — and When That's Justified
ArticleA container running as an unprivileged process is still able to see and signal processes on the host when run with `--pid=host`. Explain precisely what isolation guarantee is being intentionally broken, and describe one legitimate production use case where this trade-off is justified.
overlay2 vs. devicemapper/btrfs: Storage Driver Trade-offs at Container Density Scale
ArticleYour team deploys using the `latest` tag and occasionally ends up with different code running on different hosts despite "not changing anything." Explain why tag-based deployment without immutable references is risky in production.
Kubernetes
Declarative cluster state: how the control plane reconciles desired vs. actual, across pods, deployments, and services.
