Advanced Containers & Virtualization #dockerfile#multi-stage-build#layer-caching

Dockerfile Writing Vocabulary

5 exercises — Master the English vocabulary of writing production-quality Dockerfiles: COPY vs ADD, CMD vs ENTRYPOINT, multi-stage builds, and layer caching.

0 / 5 completed
Quick reference: Dockerfile vocabulary
  • COPY — copies local files into image; explicit, predictable, always preferred over ADD for local files
  • ENTRYPOINT — fixed executable; CMD — default arguments, overridable at docker run
  • Multi-stage build — multiple FROM instructions; COPY --from extracts only runtime artifacts
  • Layer cache — each instruction is cached; order dependencies before source to minimise cache busts
  • Exec form — JSON array syntax; process becomes PID 1 and receives signals directly
1 / 5

A code review comment reads: "You're using ADD to copy your application source into the image. Replace it with COPYADD has extra behaviour you don't need here, and it makes the Dockerfile harder to reason about."

Which statement best describes the key difference between COPY and ADD?