Docker and CI/CD · Junior · Question 7 of 75
Why is COPY usually preferred over ADD?
- 1
ADDwas removed from Dockerfiles in recent Docker versions - 2
COPYis faster because it skips the build cache completely - ✓Correct answer:
COPYjust copies;ADDalso fetches URLs and unpacks archives
Explanation
ADD has extra behavior (auto-extracting local tar files, downloading URLs) that can surprise you. Use COPY unless you need exactly that.