COPY
COPY has two forms:
COPY [--chown=<user>:<group>] <src>... <dest>
COPY [--chown=<user>:<group>] ["<src>",... "<dest>"]
(this form is required for paths containing whitespace)
Note: The
--chown
feature is only supported on Dockerfiles used to build Linux containers, and will not work on Windows containers. Since user and group ownership concepts do not translate between Linux and Windows, the use of/etc/passwd
and/etc/group
for translating user and group names to IDs restricts this feature to only be viable for Linux OS-based containers.
The COPY
instruction copies new files or directories from <src>
and adds them to the filesystem of the container at the path <dest>
.
Multiple <src>
resources may be specified but the paths of files and directories will be interpreted as relative to the source of the context of the build.
Each <src>
may contain wildcards and matching will be done using Go’s filepath.Match rules. For example:
原文地址:https://www.cnblogs.com/panpanwelcome/p/9290912.html