Docker Dockerfile COPY vs ADD
-
If
<src>is a URL and<dest>does not end with a trailing slash, then a file is downloaded from the URL and copied to<dest>. -
If
<src>is a URL and<dest>does end with a trailing slash, then the filename is inferred from the URL and the file is downloaded to<dest>/<filename>. For instance,ADD http://example.com/foobar /would create the file/foobar. The URL must have a nontrivial path so that an appropriate filename can be discovered in this case (http://example.comwill not work).
-
If
<src>is a local tar archive in a recognized compression format (identity, gzip, bzip2 or xz) then it is unpacked as a directory. Resources from remote URLs are not decompressed. When a directory is copied or unpacked, it has the same behavior astar -x: the result is the union of:- Whatever existed at the destination path and
- The contents of the source tree, with conflicts resolved in favor of "2." on a file-by-file basis.

浙公网安备 33010602011771号