This post explains the differences between the ADD and COPY instructions in Dockerfiles. It emphasizes the general recommendation to use COPY due to its simplicity and security, while highlighting scenarios where ADD might be beneficial due to its extended functionalities, such as handling URLs and unpacking archives. It also covers how these instructions operate in various build contexts, including local files, Git repositories, and OCI images, along with the associated security implications.

8m read timeFrom docker.com
Post cover image
Table of contents
Understanding file system build contextCOPY instructionADD instructionWhen to use COPY vs. ADDCOPY vs. ADD tl;dr:ConclusionLearn more

Sort: