examerioLogin
← Cloud & DevOpsQuestion 14 of 50

What is the difference between COPY and ADD in a Dockerfile?

πŸ“˜ Explanation

COPY only moves files from the build context into the image, while ADD does that too but also supports extracting local tar archives and fetching files from URLs. Since ADD's extra behavior can be unpredictable, COPY is generally preferred unless you specifically need those features. The wrong options either swap the capabilities between COPY and ADD, or incorrectly claim they are identical or used at runtime, none of which matches how these instructions actually work.

Related questions

← PreviousNo login needed