Quick Answer: This is the complete list of 50 Docker interview questions and answers for 2026 — images, Dockerfiles, volumes, networking, Compose, security, and orchestration. Each answer is short and interview-ready for DevOps and cloud roles.

Docker Fundamentals
- What is Docker?
An open-source platform to build, ship, and run applications in lightweight, portable containers. - What is a container?
A lightweight, isolated process that packages an app with its dependencies and shares the host OS kernel. - What is the difference between a container and a virtual machine?
Containers share the host kernel and are lightweight; VMs run a full guest OS and are heavier. - What is a Docker image?
A read-only template containing the app and its dependencies, used to create containers. - What is the difference between an image and a container?
An image is the static template; a container is a running instance of it. - What is Docker Engine?
The core client-server application: the daemon (dockerd), REST API, and CLI. - What is a Docker registry?
A store for images — public (Docker Hub) or private (GHCR, ECR, Harbor).
Images & Dockerfiles
- What is a Dockerfile?
A text file with instructions to build a Docker image. - Name common Dockerfile instructions.
FROM, RUN, COPY, ADD, WORKDIR, ENV, EXPOSE, CMD, ENTRYPOINT. - What is the difference between CMD and ENTRYPOINT?
ENTRYPOINT sets the fixed executable; CMD provides default, overridable arguments. - What is the difference between COPY and ADD?
COPY just copies files; ADD also handles remote URLs and auto-extracts archives. - What are image layers?
Each Dockerfile instruction creates a cached, read-only layer; containers add a writable top layer. - What is a multi-stage build?
Using multiple FROM stages to keep build tools out of the final image for smaller, safer images. - How do you reduce image size?
Minimal base images (Alpine/distroless), multi-stage builds, fewer layers, and a .dockerignore. - What is the build cache?
Docker reuses unchanged layers to speed up rebuilds; ordering instructions well maximizes cache hits.
Containers & Lifecycle
- How do you run a container in the background?
docker run -d <image>(detached mode). - How do you list running vs all containers?
docker psfor running;docker ps -afor all. - How do you enter a running container?
docker exec -it <id> bash. - What is the difference between stop and kill?
stop sends SIGTERM (graceful); kill sends SIGKILL (immediate). - How do you view container logs?
docker logs <id>. - What is a restart policy?
Controls auto-restart behavior: no, on-failure, always, unless-stopped.
Storage & Networking
- How do you persist data in Docker?
Use volumes (Docker-managed) or bind mounts (host paths). - What is the difference between a volume and a bind mount?
Volumes are managed by Docker and portable; bind mounts map a specific host directory. - What is a tmpfs mount?
Storage held in host memory only, never written to disk. - What are the Docker network drivers?
bridge (default), host, none, overlay (multi-host), and macvlan. - What is the default network for containers?
The bridge network. - How do containers on a user-defined bridge communicate?
By container name via Docker’s built-in DNS. - What is port mapping?
Exposing a container port to the host with-p host:container.
Docker Compose
- What is Docker Compose?
A tool to define and run multi-container apps from a YAML file (docker composein v2). - What is the difference between
docker runand Compose?
run starts one container; Compose orchestrates multiple services declaratively. - What does
depends_ondo?
Controls start order; combine with healthchecks to wait for readiness. - How do you scale a service in Compose?
docker compose up --scale web=3.
Security & Best Practices
- How do you secure Docker images?
Use trusted minimal base images, scan for CVEs (docker scout/Trivy), run as non-root, and sign images (Cosign). - Why avoid running containers as root?
It limits the blast radius if a container is compromised; use the USER instruction. - How do you manage secrets in Docker?
Use Docker secrets, build secrets, or external secret managers — never bake secrets into images. - What is a .dockerignore file?
Excludes files from the build context to speed builds and avoid leaking sensitive files. - What is image vulnerability scanning?
Analyzing image layers for known CVEs before deployment. - How do you clean up unused Docker resources?
docker system prune -a.
Orchestration & Advanced
- What is Docker Swarm?
Docker’s native clustering and orchestration tool. - What is the difference between Docker Swarm and Kubernetes?
Swarm is simpler and Docker-native; Kubernetes is more powerful and the industry standard. See Docker Compose vs Kubernetes. - What is a container runtime?
Software that runs containers; Docker uses containerd under the hood. - What is the OCI?
The Open Container Initiative — standards for image and runtime formats. - What is a healthcheck?
A command Docker runs to determine if a container is healthy. - What is BuildKit?
Docker’s modern, faster build engine with caching and build secrets, default in current versions. - What is the difference between EXPOSE and -p?
EXPOSE documents a port; -p actually publishes it to the host. - How do you debug a container that won’t start?
Checkdocker logs, run interactively, inspect the entrypoint, and verify resource/port conflicts. - What is the difference between
docker saveanddocker export?
save exports an image (with layers); export exports a container’s filesystem. - How do you tag and push an image?
docker tag img repo/img:tagthendocker push repo/img:tag. - How do you set up a private registry?
Run the registry image or use a managed one — see our local Docker repository guide.
Frequently Asked Questions
Are these Docker questions suitable for freshers?
Yes — fundamentals and Dockerfile sections suit freshers, while security, orchestration, and debugging target experienced candidates.
What are the most important Docker topics for interviews?
Images vs containers, Dockerfiles, multi-stage builds, volumes, networking, Compose, security, and how Docker relates to Kubernetes.
Is Docker still relevant in 2026?
Yes — Docker remains the standard for building and running containers and is foundational knowledge for Kubernetes and modern DevOps.
Related: Docker Tutorial · Kubernetes Interview Questions · DevOps Interview Questions

