DockerFile Add vs Copy
ADDhas more features than
COPYand it is suggested to use
COPYonly supports the basic copying of local files into the container.
ADDhas some features (like remote URL support)
- src can be a URI
- src can be a tar file. If the compression format is recognized, then the tar file will be automatically unpacked.
FROM debian:10 ADD wordpress-latest.tar.gz /app/er RUN find /app
Above will extract the
tar.gz package and place it under
<src>to be a URL
Docker Copy Command
- You don’t need to
mkdir abcfor the
COPYtarget, you can
COPY. /a/b and docker will create directories for you.
- Directory and Slash. You do need to add slash for command like
COPY dir1 /app.
- It will copy all content in
/app, you won’t get path like
- It is same as
COPY dir1 /app/and
COPY dir1/ /app/.
- You CAN NOT copy multiple directories to target directory.