Interview Prep/Docker/Image design and Dockerfile decisions

When would you pick `COPY` over `ADD`?

BeginnerScenarioImage design and Dockerfile decisions
Answer

Situation read → Both copy files; ADD has extra behaviours.

What I'd do → Default to COPY. Use ADD only for auto-extracting a local tar (ADD app.tar.gz /opt/) or for ADD --checksum=sha256:... https://... /file and git URLs.

Why → ADD with remote URLs and silent extraction is surprising and hard to cache or audit. For downloads I prefer curl plus checksum verification in a RUN, or ADD --checksum.

Interview tip → "COPY for intent clarity, ADD for the two cases COPY cannot do."

All Docker questions Roadmap: Docker & containers

More on Image design and Dockerfile decisions