Docker appears in almost every DevOps and cloud engineering interview, and for good reason: it is the tool that turned “it works on my machine” from a joke into a solved problem. Interviewers do not just want you to recite definitions. They want to see that you understand what happens when an image is built, a container starts, a network is created, or a deployment breaks — and that you can explain your reasoning out loud.
This guide covers the questions that come up most often, grouped by topic, with model answers written the way a strong candidate would actually say them. Each answer is complete enough to use as-is and structured so you can adapt it to your own experience. Where a question has a current twist — most notably the containerd image store becoming the default in Docker Engine 29 — the answer reflects the current state of the tool, not the version you learned three years ago.
Use this guide actively. Read a question, answer it out loud before reading the model answer, and notice where your version is thinner. The gaps are your study list. If you can explain images, layers, networking, volumes, Compose, and the containerd change without notes, you are ready for the Docker portion of almost any DevOps interview.
How Docker Interviews Work and How to Prepare
Docker questions usually sit in the middle of a broader DevOps interview, between Linux and Git on one side and Kubernetes and cloud services on the other. The interviewer is testing whether you have actually run containers in anger, not whether you have memorised the documentation. Expect a mix of direct knowledge questions, such as explaining the difference between an image and a container, and scenario questions, such as working out why a container keeps exiting or why a build is slow. Some interviews add a practical exercise: build an image, debug a failing Compose setup, or explain a Dockerfile line by line.
Preparation should be mostly hands-on. Install Docker Engine, build images from your own Dockerfiles, run containers with different flags, break things, and fix them. The candidates who do best are the ones who have seen the error messages before, because they recognise the failure instead of guessing at it.
For scenario questions, structure beats speed. State what you would check first and why, then what you would check next, and only then give the fix. Interviewers score the order of your investigation as much as the answer, because a candidate who checks the cheap and likely causes before the exotic ones is the candidate who will not waste an incident. If you do not know an answer, say so plainly and reason from what you do know: a wrong guess delivered confidently scores worse than an honest partial answer that shows your thinking.
Know which version you are talking about. Docker Engine 29 is the current major line, and it changed the default storage backend for fresh installations to the containerd image store. If an interviewer asks about image storage and you describe only the old overlay2 graph driver behavior, your answer is out of date. The release notes for Engine 29, on the official Docker documentation site, are the authoritative record of what changed. Our Docker tutorial for beginners is a good place to build the hands-on base if you are starting from scratch.
Core Concepts: Images, Containers, and the Engine
What is the difference between a Docker image and a container?
An image is a read-only template: a set of filesystem layers plus metadata describing how to run them, such as the default command and the exposed ports. A container is a running instance of an image, with its own writable layer on top, its own process, and its own network namespace. You can run many containers from one image, each isolated from the others, and deleting a container does not delete the image it came from. Data written inside a container’s writable layer is lost when the container is removed unless it lives in a volume, which is why containers are treated as disposable and state is kept outside them.
How does the Docker Engine work, and where does containerd fit in?
The Docker Engine is the software that builds images, runs containers, and manages networks and volumes on a host. When you run a docker command, the client talks to the daemon over an API, and the daemon does the work. Under the hood, the daemon relies on containerd, the industry-standard container runtime, which manages container lifecycles and, since Engine 29, image storage as well. Containerd in turn uses a low-level runtime to actually start container processes, and it uses snapshotters to manage how image layers are stored on disk.
What is the containerd image store, and what changed in Docker Engine 29?
The containerd image store is the storage backend that uses containerd snapshotters instead of Docker’s classic graph drivers, such as overlay2, to store image and container data. With Docker Engine 29, it became the default for fresh installations, while daemons upgraded from earlier versions keep using their existing backend until the containerd image store is enabled manually. The change matters because it enables features the classic store could not support: building and storing multi-platform images locally, working with images that carry attestations such as provenance and SBOM data, and running WebAssembly workloads. The official containerd image store documentation explains the behavior, the limitations, and how to enable or check it.
How do you check which storage backend a daemon is using?
Run docker info and look at the driver output. On a daemon using the containerd image store, the driver status shows a marker for the containerd snapshotter, and the driver is reported as overlayfs with a driver-type of io.containerd.snapshotter.v1. On a legacy installation the driver is reported as overlay2 with its backing filesystem details.
Dockerfile and Image Building
Explain how Docker image layers and the build cache work.
Every instruction in a Dockerfile creates a new layer, and layers are cached. When you rebuild an image, Docker reuses cached layers for instructions that have not changed and rebuilds only from the first changed instruction onward. That is why instruction order matters: put the instructions that change least often, such as installing system packages, early in the file, and the instructions that change most often, such as copying application code, late. Copying code early invalidates the cache for everything after it, including the package installation step, and turns a ten-second rebuild into a five-minute one.
What is the difference between COPY and ADD, and which should you use?
COPY copies files and directories from the build context into the image, and that is all it does. ADD does the same, but it also extracts local tar archives automatically and can fetch files from remote URLs. The official guidance is to prefer COPY in almost all cases, because its behavior is predictable and explicit. Use ADD only when you specifically need its tar extraction behavior, and even then consider extracting the archive in a separate step so the Dockerfile says what it means.
What is the difference between CMD and ENTRYPOINT?
ENTRYPOINT sets the command that always runs when the container starts, and CMD provides its default arguments. If you run a container with extra arguments on the command line, they replace the CMD values but are appended to the ENTRYPOINT. The common patterns are: ENTRYPOINT alone for a container that always runs one program, CMD alone for a container whose default command can be fully replaced, and the two together when you want a fixed program with overridable defaults. The classic example is an image with ENTRYPOINT set to a database client and CMD set to its default flags — running the container with different flags changes the flags, not the program.
What are multi-stage builds, and why should you use them?
A multi-stage build uses several FROM instructions in one Dockerfile, with each stage building on the previous one, and only the final stage becomes the shipped image. The usual pattern is a build stage that compiles the application with all its compilers and dependencies, and a runtime stage that copies only the compiled artifact into a minimal base image. The result is a much smaller image with no build tools in it, which means a smaller attack surface, faster pulls, and less to patch. Our Dockerfile best practices guide covers multi-stage builds in detail, including how to name stages, copy artifacts between them, and choose a minimal base image.
Networking, Volumes, and Storage
How does Docker networking work? Explain bridge, host, and none.
Docker creates virtual networks that connect containers to each other and to the outside world. The default bridge network gives each container its own IP address on a private network and uses port mapping to expose container ports on the host. Containers on the same user-defined bridge network can reach each other by name, because Docker runs an embedded DNS server for those networks, while containers on the default bridge network cannot resolve each other by name and should be moved to a user-defined network. The host network removes isolation entirely: the container shares the host’s network namespace, so it uses the host’s IP address and ports directly, which is fast but removes the isolation that makes containers useful. The none network gives a container no network interface at all, which is useful for workloads that must be fully isolated.
What is the difference between a volume, a bind mount, and a tmpfs mount?
A volume is storage managed by Docker, kept in a Docker-controlled part of the host filesystem, and it is the recommended way to persist data. A bind mount maps a specific host directory or file into a container, which is useful when you need to edit files on the host and see the change inside the container, such as mounting source code during development. A tmpfs mount stores data in the host’s memory, so it is fast and never written to disk, but it disappears when the container stops. The exam-style distinction interviewers want: volumes are portable and managed, bind mounts depend on the host’s directory structure and are less portable, and tmpfs is for sensitive or temporary data that should never touch a disk.
A container cannot reach another container by name. How do you troubleshoot it?
Start by checking whether both containers are on the same user-defined network, because name resolution only works there — containers on the default bridge network cannot resolve each other by name. Then inspect the network to confirm both containers are attached, and check the target container is actually running and listening on the expected port, because a container that has exited will not answer anything. Then test connectivity step by step: ping the container by IP to test the network, then by name to test DNS, then connect to the port to test the application. If the IP works but the name does not, the problem is DNS or the network attachment. If the name resolves but the connection is refused, the application is not listening or is listening on a different port.
How do you manage disk space when Docker fills the disk?
Find out what is using the space first: docker system df shows how much space images, containers, and volumes are using, and docker system prune removes unused data. The usual culprits are dangling images from rebuilds, stopped containers, unused volumes, and the build cache. With Engine 29, there is an extra wrinkle to mention: on the containerd image store, images occupy more disk than they did under the classic drivers because containerd stores both compressed and uncompressed layers, and image data lives under the containerd data directory rather than the Docker data directory, so a custom data directory configured for Docker does not automatically move it. Mentioning that shows the interviewer your knowledge is current.
Docker Compose and Multi-Container Applications
What is Docker Compose, and when should you use it?
Docker Compose is a tool for defining and running multi-container applications from a single YAML file. You declare the services, their images or build contexts, networks, volumes, environment variables, and dependencies, and then a single command starts the whole stack. It is the right tool for local development, integration testing, and small single-host deployments where the application has a handful of cooperating services — a web application, a database, and a cache, for example. It is not an orchestrator for production clusters; that is what Kubernetes or Docker Swarm is for.
How do services in a Compose file communicate, and what does depends_on actually do?
Compose creates a dedicated network for the project, and services on that network reach each other by service name, which resolves through Docker’s embedded DNS. That is why a web service can connect to a database at a hostname that matches the service name in the file. The depends_on option controls startup order: it starts the dependency before the service that depends on it. The trap — and the thing interviewers are testing — is that depends_on controls order, not readiness. A database container can be started but not yet accepting connections when the application tries to connect, so the application fails. The correct fix is a healthcheck on the database combined with a depends_on condition that waits for the service to become healthy, or retry logic in the application itself.
How do you handle configuration and secrets in Compose?
Configuration belongs in environment variables and mounted files, not baked into images. Use an env_file or the environment section for non-sensitive settings, and keep the file itself out of version control when it holds anything sensitive. For real secrets, use Docker secrets where available, or mount secret files at runtime from a secure store, and never commit credentials into the Compose file or the image. A strong answer also mentions the difference between build-time and run-time configuration: values needed when the image is built belong in build arguments, while values needed when the container runs belong in environment variables, and confusing the two is a common source of images that work on one machine and fail on another.
Docker in Production: Security, Registries, and Troubleshooting
How do you secure a Docker host and its containers?
Security is layered, and a good answer walks through the layers. Keep the daemon and the host patched, and never expose the Docker socket over the network without TLS, because anyone who can reach the socket effectively has root on the host. Run containers as a non-root user wherever possible, use read-only root filesystems with volumes for the paths that need writes, and drop Linux capabilities the container does not need. Use minimal base images and scan images for known vulnerabilities before they reach a registry, and pin images by digest rather than by a mutable tag so a deployment cannot silently change. Limit container resources with CPU and memory constraints so one container cannot starve the host, and collect container logs centrally so suspicious behavior is visible.
What is the difference between an image tag and a digest?
A tag is a human-readable label, such as latest or 1.4.2, that points to an image, and it can be moved to point at a different image at any time. A digest is a hash of the image content, and it always refers to exactly the same image. That is why production deployments should reference digests: a tag can change underneath you, so two deployments of the same tag can run different code, while a digest guarantees reproducibility. A good answer adds that the containerd image store in Engine 29 makes this distinction more visible, because image IDs under that store are often identical to the manifest digest, reflecting the content-addressed design.
How do you troubleshoot a container that keeps exiting?
Start with docker ps to see the exit code, then docker logs to read what the application printed before it died, then docker inspect to check the configuration — the command, the environment, the mounts, and the restart policy. The common causes form a short checklist: the application itself is crashing, the command is wrong, a required environment variable or file is missing, a volume is mounted over the directory the application needs, or a health check or liveness probe is killing a healthy container. Check the logs from the previous container instance when the current one has already restarted, because the evidence is in the run that failed. Finish by describing the fix in terms of the cause, not the symptom: if the application needs a variable, set it in the Compose file or the run command rather than rebuilding the image around a missing value.
What changed in Docker Engine 29 that an interviewer might ask about?
The headline change is the containerd image store becoming the default for fresh installations, with upgraded daemons keeping their existing backend until they opt in. There are also smaller changes worth knowing: the minimum supported Engine API version moved to 1.44, the Go runtime and BuildKit were updated, and lazy pulling became configurable through a daemon feature that is enabled by default for remote snapshotters such as stargz, nydus, overlaybd, and soci. The official Docker Engine 29 release notes list every change by patch release, including the 29.9.0 release of 8 October 2026, and they are the source to check before an interview rather than a blog summary.
Scenario Questions and Tricky Follow-Ups
A build is slow even though nothing in the code changed. What do you check?
Check the layer cache first: a changed file in an early COPY instruction invalidates every layer after it, so a large file copied early can make every build slow. Check the build context size, because Docker sends the whole context to the daemon, and a context that includes node modules, build artifacts, or test data makes every build slow before it even starts; a .dockerignore file that excludes those directories is the fix. Check whether the base image is being pulled fresh each time instead of cached, and whether a package installation step runs without a cache because its inputs change on every build.
Two containers need to share data, but the data must survive container restarts. What do you do?
Use a named volume mounted into both containers. Named volumes are managed by Docker, persist independently of any single container’s lifecycle, and can be shared between containers. A bind mount would also work, but it ties the setup to a specific host path and is less portable, while data written to a container’s writable layer disappears when the container is removed. The answer should name the trade-off explicitly: volumes for portability and Docker management, bind mounts for host integration, and never the writable layer for anything that matters.
How would you run Docker in production: Compose, Swarm, or Kubernetes?
The honest answer is that it depends on scale, and the interviewer wants the reasoning. Compose is right for development and for small single-host deployments. Swarm is simpler than Kubernetes and suits teams that want orchestration without its complexity, but its ecosystem is much smaller now. Kubernetes is the standard for multi-host production workloads, with scheduling, self-healing, rolling updates, and a large ecosystem, at the cost of real operational complexity. Our Kubernetes interview questions and answers guide covers the orchestrator side of this decision in the same format.
Frequently Asked Questions
How much Docker do I need to know for a DevOps interview?
Enough to build, run, network, and troubleshoot containers without notes. Interviews rarely ask about obscure flags, but they reliably test images, layers, Dockerfiles, networking, volumes, Compose, and the containerd change in Engine 29. Hands-on practice matters more than reading: build images, break containers, and fix them yourself.
Is Docker still relevant now that Kubernetes uses containerd directly?
Yes. Kubernetes uses containerd as its runtime, but Docker remains the standard tool for building images and for local development. The containerd image store in Engine 29 actually brings Docker and Kubernetes closer together, because both now use containerd for image storage. Knowing Docker well still matters for any role that builds or ships containerized applications.
Should I learn Docker before Kubernetes?
Yes, in almost all cases. Kubernetes orchestrates containers, and the concepts it builds on — images, Pods, networking, and storage — make far more sense once you have run containers yourself. Learn Docker first, get comfortable with images and Compose, and then move on to Kubernetes with that foundation in place.
What is the most common Docker interview mistake?
Reciting definitions without explaining the trade-off. Interviewers hear the definition of a volume or a layer a dozen times a day; what they remember is the candidate who explains when to use a volume instead of a bind mount, or why a Dockerfile instruction belongs early rather than late. Always finish an answer with the decision or the mistake it prevents.
How do I prepare for a practical Docker exercise in an interview?
Practice the exact tasks interviews use: write a Dockerfile for a small application, build and run it, fix a failing Compose setup, and debug a container that will not start. Time yourself, work without notes, and narrate what you are doing as you go, because interviewers score your reasoning as much as your result.
Conclusion
Docker interviews reward the same thing Docker itself rewards: practical understanding over memorised facts. The candidates who do well are the ones who have built images, broken containers, and fixed them, and who can explain not just what a command does but why they chose it. Work through the questions in this guide out loud, fill the gaps with hands-on practice, and keep your knowledge current — the containerd image store in Engine 29 is the clearest example of why an answer from three years ago can be wrong today.
Once Docker is solid, the next step is orchestration: Kubernetes builds directly on everything in this guide, from images and networking to health checks and rolling updates. Practice until the answers here feel like your own words rather than something you memorised, and you will be ready for the Docker portion of any DevOps interview. The habit that carries you furthest is the simplest one: whenever something breaks, work out why before you fix it, and write down what you found so the next failure is faster to solve.



