📡 You're offline — showing cached content
New version available!
Quick Access
Tutorials Docker Docker Interview Prep

Docker Interview Prep

5 min read Quiz at the end
Key Docker interview concepts: images vs containers, layer cache, CMD vs ENTRYPOINT, volumes, networks.

Docker Interview Topics

  • Image vs Container — image is a read-only template; container is a running instance of an image
  • Layer caching — each instruction creates a layer; unchanged layers are cached automatically
  • COPY vs ADD — COPY is explicit and preferred; ADD auto-extracts tars and accepts URLs
  • CMD vs ENTRYPOINT — CMD is overridable; ENTRYPOINT always runs with CMD as default args
  • Volume vs Bind mount — volumes are Docker-managed; bind mounts point to host filesystem paths
  • Multi-stage build — build in a large image, copy only output to a tiny final image
  • Bridge network — default isolated network; containers talk by service name as DNS hostname
  • docker run vs exec — run starts a new container; exec runs a command in an existing one
Topic Quiz · 3 questions

Test your understanding before moving on

1. What is the difference between a Docker image and a container?
💡 Images are immutable templates; containers are running instances created from images.
2. What does docker exec differ from docker run?
💡 docker exec runs a command in an already running container; docker run starts a new container.
3. Which Dockerfile instruction should you prefer for signal handling: CMD echo hello or CMD [echo, hello]?
💡 Exec form makes the process PID 1 and receives SIGTERM correctly; shell form wraps in sh.