You have already seen an example of using the COPY instruction in the hello-world Dockerfile shown in The FROM instruction section. The COPY instruction is used to copy files and folders into the Docker image being built. The syntax for the COPY instruction is as follows:
# COPY instruction syntax
COPY [--chown=<user>:<group>] <src>... <dest>
# Use double quotes for paths containing whitespace)
COPY [--chown=<user>:<group>] ["<src>",... "<dest>"]
Note that the --chown parameter is only valid for Linux-based containers. Without the --chown parameter, the owner ID and group ID will both be set to 0.
The <src> or source is a filename or folder path and is interpreted to be relative to the context of the build. We will talk more about the build context later in this chapter, but for now, think...