Back to Tech Interviews

Docker Containerization Interview Master

100+ Docker interview questions covering Dockerfile optimization, multi-stage builds, storage volumes, networking bridge/overlay, security, and Compose.

Total: 100 QuestionsLearned: 0 / 100 (0%)
Difficulty Filters

Tools & Options
Showing 100 of 100 questions
Beginner
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.

Beginner
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.

Beginner
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.

Beginner
What is the difference between an Image and a Container?
Beginner
What is Docker Engine?
Beginner
What is Docker Hub?
Beginner
Explain Docker Architecture.
Beginner
What is a Dockerfile?
Beginner
What is Docker Compose?
Beginner
What is the command to run a container?
Beginner
How do you check running containers?
Beginner
How do you check all containers (running and stopped)?
Beginner
How do you stop a running container?
Beginner
How do you remove a stopped container?
Beginner
How do you remove a Docker image?
Beginner
What is the command to list all images?
Beginner
How do you pull an image from Docker Hub?
Beginner
What is Docker Swarm?
Beginner
What is the difference between Virtual Machines and Docker Containers?
Beginner
What is a Docker Volume?
Beginner
What does the `FROM` instruction do in a Dockerfile?
Beginner
What does the `RUN` instruction do?
Beginner
What is the `docker build` command used for?
Beginner
How do you map a port from host to container?
Beginner
What is the `docker exec` command used for?
Intermediate
Explain the difference between CMD and ENTRYPOINT in a Dockerfile.
Intermediate
What are Docker Namespaces?
Intermediate
What are Docker Control Groups (cgroups)?
Intermediate
What is the difference between `COPY` and `ADD` in a Dockerfile?
Intermediate
How does Docker handle networking by default?
Intermediate
What is a Bridge Network in Docker?
Intermediate
How can you pass environment variables to a Docker container?
Intermediate
What is the purpose of `.dockerignore` file?
Intermediate
How do you scale services with Docker Compose?
Intermediate
What is dangling image and how to remove them?
Intermediate
Explain Bind Mounts vs Volumes.
Intermediate
What does the `EXPOSE` instruction do?
Intermediate
How do you view logs of a Docker container?
Intermediate
What is a multi-stage Docker build?
Intermediate
How do you execute a command within a running container?
Intermediate
What happens to data when a container exits?
Intermediate
What are Docker Labels?
Intermediate
How do you restart a Docker container automatically if it crashes?
Intermediate
What is `docker system prune`?
Intermediate
How can a container communicate with the host machine?
Intermediate
What is overlay network in Docker?
Intermediate
What is difference between `docker start` and `docker run`?
Intermediate
How to specify a custom Dockerfile name when building an image?
Intermediate
What is a dangling volume and how to clean it?
Intermediate
How to inspect detailed configuration of a container?
Advanced
How does Docker caching work during `docker build`?
Advanced
Why should you minimize the number of layers in a Docker image?
Advanced
Explain User Namespace Remapping in Docker.
Advanced
What is Docker Storage Driver?
Advanced
How do you manage secrets in Docker Compose?
Advanced
How do you handle graceful shutdowns of Docker containers?
Advanced
What is a Node in Docker Swarm?
Advanced
How do you backup, restore, or migrate data volumes?
Advanced
What are Docker Content Trust (DCT) and Image Signing?
Advanced
How can you speed up CI/CD pipeline Docker builds?
Advanced
What is Docker BuildKit?
Advanced
Explain the `HEALTHCHECK` instruction.
Advanced
How do you limit CPU and Memory for a container?
Advanced
What is a Zombie Process in a container and how do you prevent it?
Advanced
How do you configure a container to use a specific DNS server?
Advanced
What is `scratch` image in Docker?
Advanced
Explain what `docker context` is.
Advanced
How do you troubleshoot a container that immediately exits?
Advanced
What is the difference between `docker-compose up` and `docker-compose run`?
Advanced
How to use `docker wait`?
Advanced
What is Macvlan network in Docker?
Advanced
How does the `ARG` instruction differ from `ENV`?
Advanced
What is Docker's Copy-on-Write (CoW) strategy?
Advanced
How to log container output to an external system?
Advanced
What is the `ONBUILD` instruction used for?
Scenario
You forgot your container's internal IP. How do you find it?
Scenario
Your host is out of space. You want to remove ALL unused Docker data (containers, networks, images, and volumes).
Scenario
How do you enter a bash shell of a running Alpine Linux container to debug?
Scenario
You want to build a Dockerfile named `build.docker` in the `src` directory.
Scenario
How do you copy a log file from a container to your host machine?
Scenario
How do you force stop a frozen container without waiting 10 seconds?
Scenario
Your database container failed to start. How do you check what happened in the last 20 log lines?
Scenario
How do you start a container, execute an ephemeral command, and ensure it deletion automatically afterwards?
Scenario
How do you restart all services defined in a docker-compose file while rebuilding their images?
Scenario
You need to export an image to a tarball file to transfer it via USB.
Scenario
How do you load the Docker image you just transferred via USB?
Scenario
A container is consuming too much memory and freezing your host. How do you limit it dynamically?
Scenario
How do you display real-time resource usage statistics for all running containers?
Scenario
You want to run a Redis container interactively, testing a few commands, then exit without leaving the container behind.
Scenario
You modified a file locally in your React app. How do you see the changes immediately in the Dockerized app without rebuilding?
Scenario
How do you see all environment variables available inside a running container?
Scenario
How do you inspect the differences between the container's writable layer and the base image?
Scenario
How do you commit a container's file changes into a new image?
Scenario
How do you see the intermediate layers that make up a Docker image?
Scenario
How to quickly fetch only the IDs of all running containers?
Scenario
How do you stop all running containers using a single command?
Scenario
Your `.env` file requires specific parsing for Docker Compose. How do you verify the compiled compose file before running it?
Scenario
In swarm mode, how do you see all tasks/containers running for a specific service?
Scenario
How to mount the docker socket into a container so the container can start other containers?
Scenario
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.

Continuous learning: Practice daily, mark completed questions as learned, and revisit difficult concepts.Explore All Interview Tracks →

Explore Related Tools

Hand-picked utilities and calculators related to this tool.

Related Tools