The COPY
instruction is similar to ADD
instruction. It copies new files or directories from <src>
and adds them to the container filesystem at a path <dest>
.
The only difference between COPY
and ADD
is: that COPY
instruction doesn't copy content from remote URL
COPY [--chown=<user>:<group>] <src>... <dest>
COPY [--chown=<user>:<group>] ["<src>",... "<dest>"]
NOTE: Here, --chown
is only for Linux containers, and doesn’t work for Windows.
COPY . /path/to/image/filesystem/
COPY clou* /cloudyfoxdir/
?
will replace any single character like cloudy.txt:COPY cloud?.txt /cloudyfoxdir/
Here, the destination is an absolute path or relative path to WORKDIR. Below is an example of a relative path and this will add cloudy.txt file to <WORKDIR>/relativeDir/
:
COPY cloudy.txt relativeDir/
Similarly, the following example uses an absolute path and adds cloudy.txt file to /absoluteDir/
:
COPY cloudy.txt /absoluteDir/