Containers

What is the difference between ADD and COPY in Containerfile/Dockerfile?

Difficulty: unrated

Source: bregman-arie/devops-exercises by Arie Bregman

Answer

COPY takes in a source and destination. It lets you copy in a file or directory from the build context into the Docker image itself.

ADD lets you do the same, but it also supports two other sources. You can use a URL instead of a file or directory from the build context. In addition, you can extract a tar file from the source directly into the destination.