COPY copies files from the build context into the image filesystem — similar to the Unix cp command.
COPY [--chown=<user>:<group>] <src>... <dest>
Two forms: COPY source dest and COPY ["source", "dest"]. The JSON array form is required when paths contain spaces. Wildcards can match multiple files or directories.
The <src> path must be inside the build context — you cannot copy from outside it (e.g., ../another_dir/myfile is invalid).
If <src> is a directory, the entire directory contents are copied, including filesystem metadata. If <src> is a file and <dest> ends with /, it is treated as a directory.
Examples:
# Copying files:
COPY home.txt /mydir/
# Copying a directory:
COPY folder /mydir/folder/
Andrew Dorokhov