Difficulty: Beginner
When should you use ADD instead of COPY in a Dockerfile?
Generally, **always use COPY**. It is more transparent and only supports the basic copying of local files into the container.
Use **ADD** only when you need its extra features: 1. Downloading files from a URL. 2. Automatically extracting local tarballs/archives into the image.
# Standard usage
COPY app.js /app/
# Specific ADD usage (extracting)
ADD source.tar.gz /app/
ADD will detect the .tar.gz and extract its contents automatically.
Dockerfile, Filesystem