Docker Interview Questions
19 questions
Docker interview questions spanning image and build fundamentals (layer caching, multi-stage builds, image size trade-offs), networking (container-to-container connectivity, DNS-based service discovery), and volumes/persistence (bind mounts versus named volumes, data-loss scenarios, backup strategy) — grounded in real debugging scenarios engineers actually hit, not just command syntax.
What's the actual difference between a Docker image and a Docker container? People use the words interchangeably, but they're not the same thing.
BeginnerDocker5 min
What's the tradeoff between alpine and slim/distroless base images for a Node.js service?
IntermediateDockerNodejs6 min
How does Docker layer caching behave differently on CI runners without a persistent Docker daemon between builds, and how would you mitigate the resulting slowdown?
IntermediateDocker6 min
Your CI pipeline's Docker build takes 12 minutes and produces a 1.8GB image for a small Node.js service. How would you diagnose and fix it?
IntermediateDockerNodejsCI/CD10 min
How would you further reduce a Docker image's size if the runtime still needs native binary dependencies, beyond what a multi-stage build alone achieves?
AdvancedDocker7 min
What's the difference between a container's internal port and a host-published port, and how does confusing them cause debugging headaches?
BeginnerDocker5 min
How does Docker's DNS-based service discovery actually work under the hood for containers on a user-defined network?
IntermediateDocker6 min
Two containers on the same Docker host can't talk to each other over the network, even though both are running. How would you debug the connection?
BeginnerDocker8 min
How would container-to-container networking troubleshooting change once these containers move to Kubernetes, where networking works differently from plain Docker?
IntermediateDockerKubernetes7 min
A Docker host's disk usage keeps growing even though containers are regularly removed — how do anonymous volumes cause this, and how do you clean them up?
IntermediateDocker6 min
How do you actually back up and restore a Docker named volume, given that the data lives inside Docker-managed storage you can't directly browse from the host?
IntermediateDocker6 min
A container fails to write to a bind-mounted directory with permission denied, even though the host directory has permissive permissions — why?
AdvancedDocker7 min
A container was recreated to deploy a new image version, and all its data disappeared — what went wrong with the volume configuration?
IntermediateDocker6 min
How would you design volume mounts for a containerized production database, considering both data persistence and backup requirements?
AdvancedDocker7 min
What's the actual difference between a Docker named volume and a bind mount, and when does choosing wrong cause a real problem?
BeginnerDocker6 min
How would you harden a container to run with a read-only root filesystem, given that some part of the application still needs to write to disk somewhere?
AdvancedDocker7 min
Two containers need to share the same data — one writes, another reads. How would you design this safely with Docker volumes?
IntermediateDocker6 min
When would you use a tmpfs mount instead of a regular volume, and why does it matter for handling sensitive data like decrypted secrets?
IntermediateDocker6 min
Standard Docker volumes are tied to a single host — how would you give containers access to network-backed storage that survives even the host itself being replaced?
AdvancedDocker7 min