Tuesday, 6 March 2018

Dockerfile ADD vs Dockerfile Copy



ADD: ADD will do more than COPY can do.
Syntax: ADD <src> <dest>

Source can be the localfilesytem or it may also URL. It can copy and auto-extracted into the image if file in zip format.

Syntax: ADD Project/resources.tar.gz /usr/local

Now if you thought about, why not wget and curl both are capable of  getting files, but boss you have to install both tools on the container.

Copy: Copy doesn't support URL as <src> unable to download file from remote locations and unable to extract the files.
 COPY is just use for copy-files-to-container without any surprises.

Example:

Dockerfile

COPY app.sh /var/app/
ADD app.tar /var/app/

No comments:

Post a Comment