docker_practice/image/dockerfile/copy.md

37 lines
1.6 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

# COPY
* `COPY [--chown=<user>:<group>] <源路径>... <目标路径>`
* `COPY [--chown=<user>:<group>] ["<源路径1>",... "<目标路径>"]`
`RUN`
`COPY` `<源路径>` / `<目标路径>`
```docker
COPY package.json /usr/src/app/
```
`<源路径>` Go [`filepath.Match`](https://golang.org/pkg/path/filepath/#Match) 规则,如:
```docker
COPY hom* /mydir/
COPY hom?.txt /mydir/
```
`<目标路径>` `WORKDIR`
使 `COPY` 使 Git
使 `--chown=<user>:<group>`
```docker
COPY --chown=55:mygroup files* /mydir/
COPY --chown=bin files* /mydir/
COPY --chown=1 files* /mydir/
COPY --chown=10:11 files* /mydir/
```