Jul 28, 8:39

A difference between RUN and ADD in Dockerfile

The truth is when you copy file of a directory by ADD it acts exactly as COPY do. If you use ADD with tarball archive, it will extract it automatically into the directory, which is supplied as a second argument.


ADD file.tar.gz /code

is exactly the same as

COPY    file.tar.gz /code/
RUN     tar -xvzf /code/file.tar.gz

and will save you one line