100+ Docker Interview Questions on Core Concepts (2027)

104 Docker interview questions on core concepts: architecture, images vs containers, Dockerfile, layers, BuildKit, networks, volumes, Compose, security.

Sep 10, 2025 - 12:11
Nov 7, 2026 - 00:05
 0  327
TOPICInterview Q & APractical guide
100+ Docker Interview Questions on Core Concepts (2027)

Docker interview questions on core concepts test whether you understand how containers work: the client and daemon architecture, images and layers, Dockerfile instructions, BuildKit, networks, volumes, Compose, Swarm and container security. Freshers get definitions; experienced candidates must explain trade-offs, such as CMD versus ENTRYPOINT or volumes versus bind mounts. This page has 104 concept questions with answers, grouped by experience level.

The answers were checked against docs.docker.com in November 2026. For hands-on troubleshooting (containers that exit, broken networking, slow builds, registry errors), use our companion post, 100+ Docker scenario-based interview questions. New to the topic? Start with what Docker is and why it is so popular in DevOps.

Key takeaways

  • Docker uses a client-server design: the docker CLI calls the dockerd REST API, and the daemon uses containerd, which runs containers with runc by default.
  • An image is a read-only stack of layers; a container is a running instance with a thin writable layer on top. Data in that layer disappears when the container is removed.
  • BuildKit is the default builder for Docker Engine and Docker Desktop (on Linux since Engine 23.0). It brings cache mounts, build secrets, SSH forwarding and multi-platform builds.
  • Docker Engine 29.0 and later use the containerd image store by default on fresh installs.
  • Compose files follow the Compose Specification. The top-level version key is obsolete, and the current CLI command is docker compose.
  • Swarm mode is still built into Docker Engine. "Classic Swarm", the old standalone product, is no longer actively developed.
  • Docker Desktop is free for personal use, education, non-commercial open source and businesses with fewer than 250 employees and less than $10 million in annual revenue; larger organisations need a paid subscription.

How to use this guide

Your experienceRead firstThen practise
Fresher or career switcherQuestions 1 to 38Pull, run, stop and remove containers; write a three-line Dockerfile
2 to 5 yearsQuestions 39 to 80Write a multi-stage Dockerfile and a compose.yaml with a healthcheck
Senior or leadQuestions 81 to 104Explain namespaces, cgroups, image stores, rootless mode and supply chain controls without notes

If you are preparing for a general DevOps round as well, our 200+ DevOps interview questions guide covers Linux, Git, CI/CD and Kubernetes alongside Docker.

Docker interview questions for freshers

1. What is Docker?

Docker is a platform for building, shipping and running applications in containers. A container packages an application with its libraries and settings so it runs the same way on a laptop, a CI runner or a server. Docker provides the tooling (CLI, Engine, Desktop, Hub and build tools) around that idea.

2. What is a container?

A container is an isolated process, or group of processes, running on a shared host kernel. Linux namespaces give it its own view of processes, network, mounts and hostname, and control groups limit the CPU, memory and other resources it can use. It starts from an image and adds a writable layer.

3. How is a container different from a virtual machine?

A virtual machine runs a full guest operating system with its own kernel on a hypervisor. A container shares the host's kernel and isolates only the user space. Containers start in seconds and use less memory; VMs give stronger isolation and can run a different OS kernel. Many production setups run containers inside VMs. More detail is in how Docker differs from virtual machines.

AspectContainerVirtual machine
KernelShares the host kernelOwn guest kernel
StartupUsually seconds or lessUsually tens of seconds or more
SizeMegabytes to a few hundred megabytesGigabytes
IsolationProcess-level (namespaces, cgroups)Hardware-level (hypervisor)
Typical useMicroservices, CI jobs, packaging appsMixed operating systems, strong tenant isolation

4. What is a Docker image?

An image is a read-only template used to create containers. It contains a filesystem made of layers plus metadata such as the default command, environment variables, exposed ports and the user to run as. Images are identified by a repository name, a tag and a content digest.

5. What is the difference between an image and a container?

An image is the template; a container is a running (or stopped) instance of it. You can start many containers from one image. Each container gets its own writable layer, so changes in one container do not affect the image or other containers. See Docker images vs containers.

6. Describe Docker's architecture.

Docker uses a client-server architecture. The docker client sends commands over a REST API, through a UNIX socket or a network interface, to the Docker daemon, dockerd. The daemon manages images, containers, networks and volumes and uses containerd for the container lifecycle. Containerd uses runc by default to create containers. Registries store and distribute images.

7. What is the Docker daemon?

dockerd is the background service that listens for Docker API requests and manages Docker objects: images, containers, networks and volumes. It usually runs as root and listens on /var/run/docker.sock. Whoever can talk to it can control the host, so access must be limited.

8. What is the Docker client?

The docker command-line tool. It turns commands such as docker run into API calls to a daemon. One client can talk to several daemons, local or remote, which you switch between with Docker contexts.

9. What is Docker Engine?

Docker Engine is the open source container runtime package for Linux: the daemon, its API and the CLI, along with containerd and runc. It is what you install on a Linux server. Docker Desktop bundles Docker Engine with a VM and GUI for macOS, Windows and Linux desktops.

10. What is Docker Desktop, and is it free?

Docker Desktop is an application for macOS, Windows and Linux that runs Docker Engine in a lightweight VM and adds a GUI, Compose, Kubernetes and extensions. It is free for personal use, education, non-commercial open source and small businesses with fewer than 250 employees and less than $10 million in annual revenue. Larger organisations and government entities need a paid Pro, Team or Business subscription.

11. What is a container registry?

A registry stores and distributes images. Docker Hub is the default public registry. Others include Amazon ECR, Azure Container Registry, Google Artifact Registry, GitHub Container Registry, GitLab Container Registry and self-hosted options such as Harbor. docker pull downloads from a registry and docker push uploads to it.

12. What is the difference between a registry and a repository?

A registry is the service (for example Docker Hub). A repository is a named collection of related images inside it, such as library/nginx, with each version identified by a tag. One registry holds many repositories.

13. What is an image tag?

A tag is a human-readable label for an image version, such as nginx:1.27 or app:2026.11.07. If you omit it, Docker assumes latest. Tags are mutable: the same tag can point at a different image after a new push.

14. What is an image digest, and why use it?

A digest is a SHA-256 hash of the image manifest, written as image@sha256:.... Unlike a tag, it always identifies exactly the same content. Deploying by digest guarantees you run the image you tested and scanned.

15. What are image layers?

Each filesystem-changing instruction in a Dockerfile creates a layer that records the difference from the previous one. Layers are stacked to form the image filesystem. They are shared between images and cached during builds, so a change rebuilds only the affected layer and the layers after it.

16. What is the container's writable layer?

When a container starts, Docker adds a thin writable layer on top of the image's read-only layers. All file changes in the container go there, using copy-on-write for files that came from the image. The layer is deleted with the container, so persistent data belongs in volumes.

17. What is a Dockerfile?

A text file of instructions that tells the builder how to create an image: which base to start from, which files to copy, which commands to run and how to start the app. docker build reads it, usually from the root of the build context.

18. Show a simple Dockerfile and explain it.

# syntax=docker/dockerfile:1
FROM python:3.13-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
USER 1000
EXPOSE 8000
CMD ["python", "app.py"]

It starts from a slim Python image, sets /app as the working directory, installs dependencies before copying source (so code edits do not rebuild the install layer), runs as a non-root UID, documents port 8000 and starts the app in exec form.

19. What is the build context?

The set of files the builder can access, usually the directory passed to docker build, such as .. COPY and ADD can only read from the context (or from other stages, named contexts and images). A large context slows every build.

20. What is a .dockerignore file?

A file in the root of the build context that lists patterns to exclude from the context, such as .git, node_modules, build output and secrets. It makes builds faster, keeps images smaller and stops sensitive files from being copied in by a broad COPY . ..

21. What does docker run do?

It creates a container from an image and starts it. If the image is not present locally, Docker pulls it first. Common options: -d (detached), -p (publish ports), -v or --mount (storage), -e (environment), --name, --network and --rm (remove when it exits).

22. What is the difference between docker run, docker create and docker start?

docker create creates a container without starting it. docker start starts an existing, stopped container. docker run does both in one step and pulls the image if needed.

23. What is the difference between docker stop and docker kill?

docker stop sends SIGTERM (or the image's STOPSIGNAL), waits for a grace period (10 seconds by default for Linux containers) and then sends SIGKILL. docker kill sends SIGKILL immediately unless you pass another signal. Prefer stop so the app can shut down cleanly.

24. What do docker ps and docker ps -a show?

docker ps lists running containers. docker ps -a also lists stopped ones, with their exit status. Both show container ID, image, command, status, published ports and name.

25. How do you see a container's logs?

docker logs <container> prints what the main process wrote to stdout and stderr. Add -f to follow, --tail 100 for recent lines and --since 10m for a time window.

26. What is the difference between docker exec and docker attach?

docker exec starts a new process inside a running container, for example docker exec -it web sh. docker attach connects your terminal to the container's main process, so pressing Ctrl+C may stop the container. Use exec for debugging.

27. What does docker inspect return?

Detailed JSON about a Docker object: configuration, state, mounts, network settings, health status and more. Use --format with Go templates to extract one field, such as docker inspect --format '{{.State.ExitCode}}' web.

28. How do you publish a container port?

Use -p host_port:container_port, for example -p 8080:80, which maps host port 8080 to port 80 in the container. You can bind to one host interface with -p 127.0.0.1:8080:80. -P publishes all exposed ports to random host ports.

29. What does EXPOSE do?

EXPOSE documents which port the application listens on. It does not publish the port to the host. You still need -p at run time, or -P to publish all exposed ports.

30. What is a Docker volume?

Persistent storage managed by Docker, stored under Docker's data directory on the host. Volumes outlive the containers that use them, can be shared between containers and can be backed by volume drivers for remote storage. Create one with docker volume create data or let Docker create it on first use.

31. How do you remove unused Docker objects?

Use the prune commands: docker container prune, docker image prune, docker volume prune, docker network prune, or docker system prune for several at once. docker system prune does not remove volumes unless you add --volumes.

32. What is a dangling image?

An image that has no tag and is not referenced by any container, often left behind when you rebuild with the same tag. docker image prune removes dangling images; docker image prune -a removes every image not used by a container.

33. What is Docker Hub?

Docker's public registry and the default for docker pull. It hosts Docker Official Images, Verified Publisher images and community images, as well as private repositories. Unauthenticated users can pull 100 times per 6 hours per IPv4 address or IPv6 /64 subnet; Personal accounts get 200.

34. What are Docker Official Images?

A curated set of images on Docker Hub, such as nginx, postgres and python, maintained with documented best practices and regular security updates. They live in the library namespace, so nginx is short for docker.io/library/nginx.

35. What does docker build -t app:1.0 . do?

It builds an image using the Dockerfile in the current directory, sends the current directory as the build context and tags the result as app:1.0. Use -f to point at a Dockerfile with another name or location.

36. How do you pass environment variables to a container?

With -e KEY=value, --env-file file.env, or ENV in the Dockerfile for defaults. In Compose, use environment or env_file. Do not use plain environment variables for highly sensitive secrets where a secrets mechanism is available, because they appear in docker inspect.

37. What is the OCI, and why does it matter to Docker users?

The Open Container Initiative maintains open specifications for container images, runtimes and distribution. Images built with Docker follow the OCI image format, so they run on other OCI-compatible runtimes such as containerd and CRI-O, which is why Kubernetes can run them without Docker.

38. Can Docker run Windows containers?

Yes. Windows containers run on Windows hosts and share the Windows kernel; Linux containers need a Linux kernel. Docker Desktop on Windows can switch between Linux containers (through a VM) and Windows containers. An image is built for one operating system and architecture, or as a multi-platform image covering several.

Docker interview questions for 2 to 5 years of experience

39. What is the difference between CMD and ENTRYPOINT?

ENTRYPOINT sets the executable the container always runs; CMD sets default arguments or a default command that users can override. With exec-form ENTRYPOINT, arguments passed to docker run are appended and replace CMD. --entrypoint overrides the entrypoint itself.

Dockerfiledocker run imagedocker run image --debug
CMD ["app", "--serve"]Runs app --serveTries to run --debug as the command
ENTRYPOINT ["app"] + CMD ["--serve"]Runs app --serveRuns app --debug

40. What is the difference between shell form and exec form?

Exec form is a JSON array, CMD ["node", "server.js"], and runs the program directly. Shell form, CMD node server.js, runs under /bin/sh -c. Shell form allows variable expansion, but the shell becomes PID 1 and does not forward signals, so docker stop may have to kill the app. Use exec form for CMD and ENTRYPOINT.

41. What is the difference between COPY and ADD?

Both copy files into the image. COPY copies from the build context, other stages or images. ADD also accepts URLs and Git repositories, and automatically extracts local tar archives; remote archives are not extracted by default. Use COPY unless you need one of ADD's extra features.

42. What is the difference between ARG and ENV?

ARG defines a build-time variable you can set with --build-arg; it is not set in the running container. ENV sets an environment variable that persists in the image and in containers. An ARG declared before FROM is outside any stage and must be redeclared after FROM to be used inside it. Neither is safe for secrets.

43. What does WORKDIR do?

It sets the working directory for the instructions that follow (RUN, CMD, ENTRYPOINT, COPY, ADD) and for the running container. It creates the directory if needed. Use it instead of RUN cd /app && ....

44. What does the USER instruction do?

It sets the user (and optionally group) for the rest of the stage and for the container's process. Without it, containers run as root. Create a dedicated user, fix file ownership with COPY --chown, and switch to it before CMD.

45. What is HEALTHCHECK, and what are its defaults?

HEALTHCHECK tells Docker how to test whether the container still works. Exit code 0 means healthy and 1 means unhealthy. Defaults: --interval=30s, --timeout=30s, --start-period=0s, --start-interval=5s and --retries=3. --start-interval needs Docker Engine 25.0 or later.

HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
  CMD wget -qO- http://localhost:8000/health || exit 1

46. What do STOPSIGNAL and ONBUILD do?

STOPSIGNAL sets the signal docker stop sends first; the default is SIGTERM. ONBUILD registers an instruction that runs later, right after the FROM line of a downstream build that uses this image as its base. Triggers are not inherited further, and ONBUILD is rarely used today because it hides behaviour from the downstream Dockerfile.

47. What is a multi-stage build?

A Dockerfile with several FROM stages, where later stages copy only selected files from earlier ones with COPY --from=stage. Compilers and dev dependencies stay in the build stage, so the final image is smaller and has less attack surface.

# syntax=docker/dockerfile:1
FROM golang:1.23 AS build
WORKDIR /src
COPY . .
RUN CGO_ENABLED=0 go build -o /out/app .

FROM gcr.io/distroless/static-debian12
COPY --from=build /out/app /app
ENTRYPOINT ["/app"]

More examples are in 12 Dockerfile examples for better containerization.

48. How does the build cache work?

The builder reuses a cached layer when the instruction and its inputs are unchanged. Once one step changes, every later step rebuilds. So put stable, slow steps (installing dependencies) before steps that change often (copying source). For COPY and ADD, the cache key includes the content of the files copied.

49. What is BuildKit?

BuildKit is Docker's build engine and the default builder for Docker Desktop and Docker Engine; Engine 23.0 made it the default on Linux. It runs independent stages in parallel, skips unused stages, and supports cache mounts, secret and SSH mounts, cache export and import, and multi-platform output.

50. What is the # syntax=docker/dockerfile:1 line?

A parser directive that tells BuildKit which Dockerfile frontend to use. docker/dockerfile:1 pulls the latest stable 1.x frontend, so you get newer Dockerfile features (for example COPY --exclude or heredocs) without upgrading Docker Engine.

51. What is Docker Buildx?

Buildx is the CLI plugin for BuildKit. docker buildx build exposes all BuildKit features, and docker buildx create sets up builders with different drivers, such as docker-container or remote BuildKit instances. On current Docker versions, docker build already uses Buildx and BuildKit.

52. What are cache mounts?

A RUN --mount=type=cache,target=... option that keeps a directory, such as a package manager cache, between builds without putting it in a layer. For example RUN --mount=type=cache,target=/root/.npm npm ci reuses downloaded packages even when that layer rebuilds.

53. How do build secrets work?

You pass a secret with docker build --secret id=token,src=./token.txt (or env=VAR) and mount it only in the step that needs it with RUN --mount=type=secret,id=token. By default it appears at /run/secrets/token during that step and never lands in a layer. Build arguments and environment variables do persist in the image, so they are the wrong place for secrets.

54. What are multi-platform images?

One image reference that points to variants for several platforms, such as linux/amd64 and linux/arm64, through a manifest list (image index). The client pulls the right variant automatically. Build them with docker buildx build --platform linux/amd64,linux/arm64, using QEMU emulation or cross-compilation with BUILDPLATFORM and TARGETPLATFORM.

55. What network drivers does Docker provide?

DriverWhat it does
bridgeDefault. Private network on one host; containers reach the outside through NAT
hostContainer uses the host's network stack directly, with no isolation
noneNo networking apart from loopback
overlaySpans several Docker hosts, used by Swarm services
macvlanGives each container its own MAC address on the physical network
ipvlanFine control over IPv4 and IPv6 addressing, VLAN tagging and L3 routing

Third-party network plugins can add more.

56. What is the difference between the default bridge and a user-defined bridge?

User-defined bridges provide automatic DNS resolution between containers, so they can reach each other by name or alias. On the default bridge, containers can communicate only by IP, unless you use the legacy --link option. User-defined networks also give better isolation, because only containers you attach can talk to each other.

57. How does container DNS work on user-defined networks?

Docker runs an embedded DNS server for containers on user-defined networks. It resolves container names, network aliases and Compose service names to container IPs, and forwards other queries to the DNS servers configured for the host or daemon.

58. What are the storage options for containers?

TypeWhere data livesUse it for
VolumeManaged by Docker in its data directory, or a volume driverDatabases and any persistent app data
Bind mountAny host path you chooseSharing source code or config between host and container
tmpfs mountHost memory onlyTemporary or sensitive files that must not hit disk
Named pipeWindows host pipeTools that talk to the Docker Engine API from a Windows container

Docker also lists image mounts, which expose another image's content read-only and need the containerd image store.

59. What is the difference between -v and --mount?

Both create volumes and bind mounts. --mount uses explicit key-value pairs (type=volume,source=data,target=/data,readonly), which is easier to read and supports more options. -v is shorter. One behaviour differs: with -v, a missing host path for a bind mount is created as a directory; with --mount, Docker returns an error.

60. What happens when you mount an empty volume over a directory that has files in the image?

Docker copies the existing files from the image into the new volume the first time it is mounted. A bind mount behaves differently: it hides whatever the image had at that path.

61. What is a storage driver?

The component that builds the layered image and container filesystems on the host. overlay2 is the default classic driver on mainstream Linux distributions. On Docker Engine 29.0 and later fresh installs, image content is managed by the containerd image store and its snapshotters instead.

62. What is Docker Compose?

A tool for defining and running multi-container applications from a YAML file, usually compose.yaml. One command, docker compose up, creates the networks, volumes and containers for every service. It is used for local development, CI test environments and single-host deployments. See 10 Docker Compose files explained for worked examples.

63. What is the difference between docker-compose and docker compose?

docker-compose is Compose v1, the original Python tool. docker compose is the Go-based CLI plugin used by Compose v2 and later. Docker's history page notes that Compose v5 (2025) is functionally identical to v2; the version jumped to avoid confusion with the old 2.x and 3.x file format numbers.

64. Is the version key needed in a Compose file?

No. Docker documents the top-level version property as obsolete. Compose validates against the latest Compose Specification schema regardless and prints a warning if the key is present.

65. What does depends_on do in Compose?

It controls start order. The short form only waits for the dependency's container to start. The long form adds a condition: service_started, service_healthy (waits for the healthcheck to pass) or service_completed_successfully (waits for a one-off job to exit with code 0).

66. What are Compose profiles?

Labels that make services optional. Services without profiles always start; services with a profile start only when you enable it with docker compose --profile name up or COMPOSE_PROFILES=name. Teams use them for admin tools, debuggers and seed jobs.

67. What is Compose Watch?

A development feature configured under develop.watch. It watches local paths and either syncs changed files into the running container (sync), syncs and restarts (sync+restart), or rebuilds the image and replaces the container (rebuild). Start it with docker compose up --watch or docker compose watch.

68. How does Compose handle networking by default?

Compose creates a default network for the project and attaches every service to it. Services reach each other by service name. You can define extra networks, mark one as internal to block outside access, and attach services to several networks to control which tiers can talk.

69. How does Compose handle secrets?

Secrets are declared at the top level from a file or a host environment variable and granted to services. Compose mounts each one read-only at /run/secrets/<name>. Many official images accept _FILE variables, such as POSTGRES_PASSWORD_FILE, to read them.

70. What are restart policies?

PolicyBehaviour
noDefault. Never restart automatically
on-failure[:max-retries]Restart only after a non-zero exit, optionally a limited number of times
alwaysAlways restart; a manually stopped container restarts when the daemon restarts
unless-stoppedLike always, but a manually stopped container stays stopped after a daemon restart

A policy takes effect only after the container has run for at least 10 seconds, which avoids tight restart loops for containers that never start properly.

71. How do you limit container resources?

Use flags such as --memory (hard limit), --memory-reservation (soft limit), --cpus (CPU cap), --cpu-shares (relative weight under contention), --cpuset-cpus (pin to CPUs) and --pids-limit. In Compose, use deploy.resources.limits and reservations. Exceeding the memory limit triggers the kernel OOM killer.

72. What are logging drivers?

Plugins that decide where container stdout and stderr go. The default is json-file; Docker recommends local to prevent disk exhaustion because it rotates by default. Others ship logs to syslog, journald, Fluentd, cloud logging services and more. Set a default in daemon.json or per container with --log-driver.

73. What is daemon.json?

The Docker daemon's configuration file, at /etc/docker/daemon.json on Linux. It sets options such as the logging driver and log options, default address pools, DNS servers, registry mirrors, live-restore and the storage or image store settings. Most changes need a daemon restart and apply to new containers.

74. What does docker commit do, and why is it discouraged?

It creates an image from a container's current state. It is useful for debugging, but the result is not reproducible: nobody can see how it was built. Build images from a Dockerfile in version control instead.

75. What is the difference between docker save and docker export?

docker save writes one or more images, with all layers, tags and metadata, to a tar archive that docker load restores. docker export writes a container's flattened filesystem without image history or metadata; docker import turns it into a single-layer image.

76. What are Docker contexts?

Named connection settings that point the CLI at a daemon: local, remote over SSH, or another endpoint. docker context create, docker context use and docker context ls let one client manage several hosts without exporting DOCKER_HOST by hand.

77. What does docker init do?

It generates starter files for containerising a project: .dockerignore, Dockerfile, compose.yaml and README.Docker.md, using templates for languages such as Go, Java, Node, Python, Rust, PHP and ASP.NET Core. Docker documents it as a command provided by Docker Desktop. It warns before overwriting existing files.

78. What is the purpose of the --init flag?

It runs a small init process as PID 1 inside the container. The init forwards signals to the app and reaps zombie processes, which matters when the app was not written to act as PID 1.

79. How do you keep images small?

Use a slim, distroless or scratch base where it fits, multi-stage builds, a .dockerignore, and combine package install and cleanup in one RUN step. Files deleted in a later layer still take space in the earlier one.

80. How do you tag and push an image to a private registry?

Tag it with the registry host and repository, log in and push:

docker tag app:1.0 registry.example.com/team/app:1.0
echo "$TOKEN" | docker login registry.example.com -u ci-bot --password-stdin
docker push registry.example.com/team/app:1.0

--password-stdin keeps the token out of shell history. Without a credential helper, Docker stores credentials base64-encoded in ~/.docker/config.json.

Docker interview questions for senior engineers

81. Which Linux kernel features make containers possible?

Namespaces and control groups. Namespaces isolate what a process can see: process IDs, network interfaces, mount points, hostname, IPC and user IDs. Control groups (cgroups) limit and account for resources such as CPU, memory, I/O and process counts. Capabilities, seccomp and LSMs such as AppArmor and SELinux add further restrictions.

82. Walk through what happens when you run docker run nginx.

The CLI calls the daemon's API. The daemon checks for the image and pulls it from the registry if missing (resolving the tag to a manifest for your platform). It creates the container configuration, prepares the filesystem from the image layers plus a writable layer, sets up networking, and asks containerd to start it. Containerd uses runc by default to create the namespaces and cgroups and start the process.

83. How do containerd and runc relate to Docker?

Docker Engine uses containerd to manage container lifecycles, image content and snapshots. Containerd uses runc as its default low-level runtime, which talks to the kernel to create the container. Other runtimes can be plugged in, such as gVisor and Kata Containers (with their own containerd shims) or youki as a runc drop-in.

84. What changed with the containerd image store?

Docker Engine 29.0 and later use the containerd image store by default on fresh installs, while upgraded hosts keep their classic storage driver until migrated. It stores images through containerd and its snapshotters and natively supports multi-platform images, image indexes and attestations. Docker Desktop also uses it by default.

85. Does Kubernetes still use Docker?

Kubernetes removed dockershim, its built-in Docker Engine integration, in v1.24, so nodes now use CRI runtimes such as containerd or CRI-O. Images built with Docker still work because they follow the OCI image format. Docker remains common for building images and local development.

86. What is the status of Docker Swarm?

Swarm mode is built into Docker Engine and documented as a current feature for managing a cluster of Docker Engines, with services, overlay networks, secrets and rolling updates. Docker's docs separate it from "Classic Swarm", the older standalone project, which is no longer actively developed. Most new orchestration work uses Kubernetes, but Swarm mode remains a simpler option for small clusters.

87. What is the difference between a Swarm service and a container?

A container is one running instance on one host. A Swarm service is a desired state, such as "run 3 replicas of this image on port 80", that the Swarm managers schedule as tasks across nodes, replacing failed tasks and rolling out updates according to the update config.

88. What security does Docker apply to containers by default?

Namespaces and cgroups for isolation, a restricted allowlist of Linux capabilities (most are dropped), a default seccomp profile that blocks risky system calls, and an AppArmor or SELinux profile where the host supports it. User namespaces are available but not enabled by default, so root in a container is root on the host kernel unless you change that.

89. Why is running containers as root a risk?

Without user namespace remapping, UID 0 in the container is UID 0 on the host. If an attacker escapes through a kernel bug, a privileged flag or a dangerous mount, they gain root on the host. Running as a non-root user limits the damage, and is required by many platform policies.

90. What is the difference between userns-remap and rootless mode?

Both use user namespaces. With userns-remap, container root maps to an unprivileged host user, but the daemon still runs as root. In rootless mode, the daemon and containers both run as a non-root user, which also contains vulnerabilities in the daemon and runtime. Rootless mode needs newuidmap, newgidmap and subordinate UID and GID ranges.

91. What does --privileged do?

It gives the container all capabilities and access to all host devices, and Docker reconfigures AppArmor or SELinux so the container has nearly the same access to the host as processes outside containers. It is meant for special cases such as running Docker inside Docker. For normal apps, grant only the specific capability or device needed.

92. Why is mounting the Docker socket dangerous?

The socket is the daemon's API. A process that can use it can start a privileged container that mounts the host root filesystem, which amounts to root on the host. Docker's security docs stress that only trusted users should control the daemon.

93. How do Linux capabilities apply to containers?

Root's powers are split into capabilities such as NET_BIND_SERVICE, NET_ADMIN and SYS_ADMIN. Docker starts containers with a reduced allowlist. Best practice is --cap-drop ALL and then --cap-add only what the process needs, together with --security-opt no-new-privileges.

94. What is Docker Scout?

Docker's supply chain security service. It analyses images to build a software bill of materials and matches it against a continuously updated vulnerability database. CLI commands include docker scout quickview, docker scout cves, docker scout recommendations (base image updates) and docker scout sbom.

95. What are build attestations?

Signed metadata attached to an image at build time. BuildKit adds minimal provenance attestations by default; --provenance=mode=max records more detail about sources and build parameters, and --sbom=true adds a software bill of materials. They let consumers check where an image came from and what it contains.

96. How do Docker networking and host firewalls interact?

Docker manages iptables (or, experimentally, nftables) rules for container networking and port publishing. Docker's documentation states that Docker and ufw are incompatible: traffic to published ports is diverted before ufw's rules apply, so ufw does not protect them. Publish only what must be public, bind internal ports to loopback and enforce rules at the network edge.

97. How does Docker's overlay network work at a high level?

It creates a distributed network across Docker hosts in a swarm. Container traffic between hosts is carried between hosts over VXLAN (UDP port 4789 by default), with optional IPsec encryption through --opt encrypted, so containers on different nodes appear on one virtual network. Swarm services on the overlay get service discovery and built-in load balancing through a virtual IP.

98. What is live-restore?

A daemon option, "live-restore": true in daemon.json, that keeps containers running while the daemon is stopped or restarted. It supports patch-release upgrades only (YY.MM.x), not major YY.MM upgrades.

99. How should images be tagged in a mature pipeline?

Use unique, immutable tags for every build, such as a semantic version plus the Git commit SHA, enable tag immutability in the registry, and deploy by digest. Treat latest as a convenience for humans, never as a deployment reference.

100. How do you choose a base image?

Balance size, compatibility and maintenance. Distroless and scratch images minimise attack surface but have no shell for debugging. Alpine is small but uses musl libc, which can break binaries built for glibc. Debian or Ubuntu slim images are compatible and well understood. Prefer official or verified images, pin by digest and rebuild regularly for patches.

101. How does Docker fit into a CI/CD pipeline?

CI builds the image from the Dockerfile, runs tests inside or against it, scans it, attaches attestations and pushes it to a registry with an immutable tag. CD then deploys that same image to staging and production. Building once and promoting the same digest removes "works in staging, fails in production" drift caused by rebuilds.

102. When would you not containerise an application?

When the cost outweighs the benefit: software that needs a different kernel or deep hardware access, workloads that a managed platform already runs well, or a small team without the skills to operate containers safely. Stateful databases can run in containers, but need careful storage, backup and upgrade planning.

103. What is the Docker Engine API used for?

Everything the CLI does goes through the Engine API, a REST API exposed on a UNIX socket (or a TCP port, which must be protected with TLS). CI tools, IDEs, monitoring agents and SDKs use it to manage containers programmatically. Exposing it without TLS on a network is equivalent to giving remote root access.

104. How do you explain container isolation limits to a security team?

Containers share the host kernel, so a kernel vulnerability or misconfiguration can break isolation. Hardening (non-root users, dropped capabilities, seccomp, read-only filesystems, no socket mounts) reduces risk. For untrusted multi-tenant code, add stronger boundaries such as separate VMs or sandboxed runtimes, and keep hosts patched.

Scenario-based Docker questions

Experienced interviews always add troubleshooting rounds: a container that exits with code 137, an app that cannot reach its database, a build that suddenly takes 20 minutes, a CI job hitting Docker Hub rate limits. We keep all of those in one place so this page stays focused on concepts. Work through 100+ Docker scenario-based interview questions once you are comfortable with the answers above.

For structured practice with an instructor, our Docker training runs in the Kharadi, Pune classroom and live online. Many learners continue with the CKA course after it.

Frequently asked questions

What Docker topics are asked most often in interviews?

Containers versus VMs, images versus containers, Dockerfile instructions (especially CMD versus ENTRYPOINT and COPY versus ADD), layers and caching, multi-stage builds, networking drivers, volumes versus bind mounts, Docker Compose, and basic security such as running as non-root.

How should freshers prepare for Docker interview questions?

Learn the core concepts in this guide, then practise on a real machine: pull and run images, write a Dockerfile, build and tag an image, publish ports, attach a volume and write a small compose.yaml. Interviewers often ask you to explain a command you have actually run.

Is Docker still relevant now that Kubernetes removed dockershim?

Yes. Kubernetes removed dockershim in v1.24 and runs containers through CRI runtimes such as containerd, but images built with Docker follow the OCI format and run unchanged. Docker remains widely used to build images, run local environments and power CI pipelines.

What is the difference between Docker and Kubernetes?

Docker builds images and runs containers, mostly on one host. Kubernetes orchestrates containers across a cluster of machines, handling scheduling, scaling, self-healing, service discovery and rolling updates. A common path is Docker for building and local work, Kubernetes for production.

Do I need Docker Desktop to learn Docker?

No. On Linux you can install Docker Engine directly. Docker Desktop is convenient on macOS and Windows and is free for personal use, education and small businesses under 250 employees and $10 million in revenue; larger companies need a paid subscription for it.

Is Docker Swarm deprecated?

Swarm mode is still built into Docker Engine and documented as a current feature. What Docker describes as no longer actively developed is Classic Swarm, the older standalone product. Kubernetes has the larger ecosystem, but Swarm mode remains usable for small clusters.

What is the difference between CMD and ENTRYPOINT?

ENTRYPOINT defines the executable the container always runs. CMD provides default arguments, or a default command, that docker run arguments override. A common pattern is ENTRYPOINT for the binary and CMD for its default flags, both in exec (JSON array) form.

Where can I practise Docker troubleshooting questions?

Our companion post, 100+ Docker scenario-based interview questions, covers container exits, networking, volumes, image size, build cache, registry authentication, resource limits and security incidents, with the commands to use in each case.

References

Interested in learning more?Get a callback from our training advisors.

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Angry Angry 0
Sad Sad 0
Wow Wow 0
Mridul I am a passionate technology enthusiast with a strong focus on DevOps, Cloud Computing, and Cybersecurity. Through my blogs at DevOps Training Institute, I aim to simplify complex concepts and share practical insights for learners and professionals. My goal is to empower readers with knowledge, hands-on tips, and industry best practices to stay ahead in the ever-evolving world of DevOps.