2
Dockerfile syntax has two instructions for copying files: ADDand COPY. Both copy files to the container. When to use each?
2
Dockerfile syntax has two instructions for copying files: ADDand COPY. Both copy files to the container. When to use each?
2
The application will depend on what you are trying to transfer to the container. According to this answer on SOen, the largest difference in the method ADD to the COPY is:
ADD allows the attribute SRC be a URLSRC of the method ADD have a recognized compression format, it will be uncompressed.There is a documentation of the Docker: ADD or COPY where it informs the same thing, and that it is preferable to use the method COPY for being transparant.
That is, if you will not use the remote transfer and decompression feature, use the method COPY.
Browser other questions tagged docker
You are not signed in. Login or sign up in order to post.
Complementing: the official documentation indicates that the
ADDis not specified to fetch remote packages because it increases the image size. The given is to get withRUN curlor similar and unpack withtaror similar, then removing the original package.– Joaquim Oliveira