Docker Containerization Interview Master
100+ Docker interview questions covering Dockerfile optimization, multi-stage builds, storage volumes, networking bridge/overlay, security, and Compose.
Difficulty Filters
Tools & Options
What is Docker?
Docker is an open-source platform that enables developers to build, deploy, run, update and manage containers. It standardizes software delivery by isolating applications in environments called containers.
What is a Docker Container?
A container is a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another.
What is a Docker Image?
A Docker image is a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries, and settings.
What is the difference between an Image and a Container?
What is Docker Engine?
What is Docker Hub?
Explain Docker Architecture.
What is a Dockerfile?
What is Docker Compose?
What is the command to run a container?
How do you check running containers?
How do you check all containers (running and stopped)?
How do you stop a running container?
How do you remove a stopped container?
How do you remove a Docker image?
What is the command to list all images?
How do you pull an image from Docker Hub?
What is Docker Swarm?
What is the difference between Virtual Machines and Docker Containers?
What is a Docker Volume?
What does the `FROM` instruction do in a Dockerfile?
What does the `RUN` instruction do?
What is the `docker build` command used for?
How do you map a port from host to container?
What is the `docker exec` command used for?
Explain the difference between CMD and ENTRYPOINT in a Dockerfile.
What are Docker Namespaces?
What are Docker Control Groups (cgroups)?
What is the difference between `COPY` and `ADD` in a Dockerfile?
How does Docker handle networking by default?
What is a Bridge Network in Docker?
How can you pass environment variables to a Docker container?
What is the purpose of `.dockerignore` file?
How do you scale services with Docker Compose?
What is dangling image and how to remove them?
Explain Bind Mounts vs Volumes.
What does the `EXPOSE` instruction do?
How do you view logs of a Docker container?
What is a multi-stage Docker build?
How do you execute a command within a running container?
What happens to data when a container exits?
What are Docker Labels?
How do you restart a Docker container automatically if it crashes?
What is `docker system prune`?
How can a container communicate with the host machine?
What is overlay network in Docker?
What is difference between `docker start` and `docker run`?
How to specify a custom Dockerfile name when building an image?
What is a dangling volume and how to clean it?
How to inspect detailed configuration of a container?
How does Docker caching work during `docker build`?
Why should you minimize the number of layers in a Docker image?
Explain User Namespace Remapping in Docker.
What is Docker Storage Driver?
How do you manage secrets in Docker Compose?
How do you handle graceful shutdowns of Docker containers?
What is a Node in Docker Swarm?
How do you backup, restore, or migrate data volumes?
What are Docker Content Trust (DCT) and Image Signing?
How can you speed up CI/CD pipeline Docker builds?
What is Docker BuildKit?
Explain the `HEALTHCHECK` instruction.
How do you limit CPU and Memory for a container?
What is a Zombie Process in a container and how do you prevent it?
How do you configure a container to use a specific DNS server?
What is `scratch` image in Docker?
Explain what `docker context` is.
How do you troubleshoot a container that immediately exits?
What is the difference between `docker-compose up` and `docker-compose run`?
How to use `docker wait`?
What is Macvlan network in Docker?
How does the `ARG` instruction differ from `ENV`?
What is Docker's Copy-on-Write (CoW) strategy?
How to log container output to an external system?
What is the `ONBUILD` instruction used for?
You forgot your container's internal IP. How do you find it?
Your host is out of space. You want to remove ALL unused Docker data (containers, networks, images, and volumes).
How do you enter a bash shell of a running Alpine Linux container to debug?
You want to build a Dockerfile named `build.docker` in the `src` directory.
How do you copy a log file from a container to your host machine?
How do you force stop a frozen container without waiting 10 seconds?
Your database container failed to start. How do you check what happened in the last 20 log lines?
How do you start a container, execute an ephemeral command, and ensure it deletion automatically afterwards?
How do you restart all services defined in a docker-compose file while rebuilding their images?
You need to export an image to a tarball file to transfer it via USB.
How do you load the Docker image you just transferred via USB?
A container is consuming too much memory and freezing your host. How do you limit it dynamically?
How do you display real-time resource usage statistics for all running containers?
You want to run a Redis container interactively, testing a few commands, then exit without leaving the container behind.
You modified a file locally in your React app. How do you see the changes immediately in the Dockerized app without rebuilding?
How do you see all environment variables available inside a running container?
How do you inspect the differences between the container's writable layer and the base image?
How do you commit a container's file changes into a new image?
How do you see the intermediate layers that make up a Docker image?
How to quickly fetch only the IDs of all running containers?
How do you stop all running containers using a single command?
Your `.env` file requires specific parsing for Docker Compose. How do you verify the compiled compose file before running it?
In swarm mode, how do you see all tasks/containers running for a specific service?
How to mount the docker socket into a container so the container can start other containers?
How do you format output of `docker ps` to only show the container name and its status?
Technical Interview Mastery Blueprint
Proven methodologies and frameworks to succeed in technical and architecture rounds.
1. The Engineering STAR Technique
When responding to architectural or situational questions, structure your answer using Situation, Technical Constraint, Action, and Measurable Result. Rather than jumping straight to syntax, articulate the business problem, why certain patterns (e.g. caching, queuing, immutability) were selected over alternatives, and what latency or throughput improvements were achieved.
2. Defending Architectural Trade-Offs
Senior interviewers evaluate how you weigh trade-offs. Always explain why you chose an approach: e.g., memory overhead vs CPU cycle speed, consistency vs availability (CAP theorem), or normalized schemas vs denormalized fast reads. Stating the drawbacks of your own proposal demonstrates maturity and production experience.
3. Clean Code & Edge-Case Proactivity
In live-coding rounds, communicate your thinking aloud before typing. State edge cases explicitly: null or undefined inputs, extreme boundary values, concurrency races, and network timeouts. Writing modular, well-named functions with deterministic unit tests separates junior candidates from staff-level engineers.
4. Antipatterns to Avoid
Avoid reciting memorized definitions without practical context. Never dismiss non-functional requirements such as security (CSRF, injection, token rotation), observability (logging, metrics), and accessibility (ARIA, semantic standards). Always ask clarifying scope questions before writing complex implementations.
Explore Related Tools
Hand-picked utilities and calculators related to this tool.
