Docker Interview Questions
18 questions
Why does a container image being much smaller than a VM image matter for both startup time and attack surface, specifically?
BeginnerDockerContainers6 min
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 Jenkins pipeline stage runs `docker build`. It works fine when run by hand on the agent, but fails in the pipeline with a permission denied error talking to the Docker daemon. Why?
IntermediateJenkinsDocker8 min
Why is mounting the host Docker socket into a build container considered a security risk beyond just the permission-configuration hassle?
IntermediateJenkinsDocker6 min
How would Kaniko or rootless BuildKit avoid the Docker socket mounting problem entirely, and what do you give up by switching to them?
AdvancedJenkinsDocker7 min
If a Jenkins agent ran on Kubernetes instead of a static VM, how would troubleshooting the same Docker permission problem differ?
IntermediateJenkinsKubernetesDocker6 min
How would you find the same df/du phantom-disk-usage issue on a containerized workload, where the culprit process might be in a different mount namespace?
AdvancedLinuxDocker8 min
What's the difference between a Docker container being OOM-killed by its own cgroup memory limit versus the host machine itself running out of memory?
IntermediateDocker6 min
Why does Docker report exit code 137 specifically for an OOM-killed container, and how does that map to the underlying kernel signal?
BeginnerDocker5 min
A Python script that processes a large file works fine on your laptop but gets OOM-killed when run in a container with a memory limit. What's likely wrong, and how do you fix it?
IntermediatePythonDocker8 min