Dockerfile Difference Between COPY and ADD

If you build Docker images, you probably noticed that the ADD and COPY statements are very similar and wonder the difference between them.

COPY vs ADD

The copy statement is used to copy files and folders from the localhost to the container.

The ADD statement does the same as COPY but can also copy files from external URLs and not just the localhost machine. ADD also untar files from the localhost before copying them to the container (not applicable for remote URLs).

Note: When we say localhost, we mean the server you are building the image on.

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.