Interview Q&A · questions with model answers

Docker Interview Questions

Part of the study plan for: DevOps Engineer · Site Reliability Engineer (SRE) · Cloud Engineer · Backend Engineer · Full Stack Engineer

Ordered by how often they're asked. Most-asked answers are free to read in full; members see every answer and can rate their confidence on each.

  1. Most asked What is a container, and how does it differ from a virtual machine?

    A container is an isolated process (or group of processes) on the host's Linux kernel, isolated with namespaces (what it can see: processes, network, mounts, users) and limited with cgroups (how…

  2. Most asked What is the difference between an image and a container, and how do image layers work?

    An image is a read-only template: an ordered stack of filesystem layers plus metadata (entrypoint, environment, exposed ports). A container is a running (or stopped) instance of an image with a thin…

  3. Most asked CMD or ENTRYPOINT: what is the difference, and what are exec and shell forms?

    ENTRYPOINT sets the executable the container runs; CMD provides default arguments (or a default command if there is no entrypoint), which docker run image args overrides. The exec form (["node",…

  4. Most asked ARG or ENV: what is the difference, and how do you pass secrets into a build safely?

    ARG defines build-time variables available only while building (set with --build-arg); ENV sets environment variables persisted in the image and present at runtime. Neither is safe for secrets:…

  5. COPY or ADD: what is the difference?

    COPY copies files from the build context (or another stage). ADD does the same but also extracts local tar archives automatically and can fetch remote URLs (and Git repositories). Docker recommends…

Was this page helpful?

Report a mistake