以下Dockerfile包含四个COPY图层:
COPY README.md ./ COPY package.json ./ COPY gulpfile.js ./ COPY __BUILD_NUMBER ./如何使用一层复制这些文件? 以下尝试:
COPY [ "__BUILD_NUMBER ./", "README.md ./", "gulpfile ./", "another_file ./", ]The following Dockerfile contains four COPY layers:
COPY README.md ./ COPY package.json ./ COPY gulpfile.js ./ COPY __BUILD_NUMBER ./How to copy these files using one layer instead? The following was tried:
COPY [ "__BUILD_NUMBER ./", "README.md ./", "gulpfile ./", "another_file ./", ]最满意答案
COPY README.md package.json gulpfile.js __BUILD_NUMBER ./要么
COPY ["__BUILD_NUMBER", "README.md", "gulpfile", "another_file", "./"]您也可以在sourcefile规范中使用通配符。 有关详细信息,请参阅文档 。
目录是特别的! 如果你写
COPY dir1 dir2 ./实际上是这样的
COPY dir1/* dir2/* ./如果要在单个命令中复制目标目录下的多个目录(而不是其内容),则需要设置构建上下文,以使源目录位于公共父COPY ,而副本为父级。
COPY README.md package.json gulpfile.js __BUILD_NUMBER ./or
COPY ["__BUILD_NUMBER", "README.md", "gulpfile", "another_file", "./"]You can also use wildcard characters in the sourcefile specification. See the docs for a little more detail.
Directories are special! If you write
COPY dir1 dir2 ./that actually works like
COPY dir1/* dir2/* ./If you want to copy multiple directories (not their contents) under a destination directory in a single command, you'll need to set up the build context so that your source directories are under a common parent and then COPY that parent.
如何使用Dockerfile在一个层中复制多个文件?(How to copy multiple files in one layer using a Dockerfile?)以下Dockerfile包含四个COPY图层:
COPY README.md ./ COPY package.json ./ COPY gulpfile.js ./ COPY __BUILD_NUMBER ./如何使用一层复制这些文件? 以下尝试:
COPY [ "__BUILD_NUMBER ./", "README.md ./", "gulpfile ./", "another_file ./", ]The following Dockerfile contains four COPY layers:
COPY README.md ./ COPY package.json ./ COPY gulpfile.js ./ COPY __BUILD_NUMBER ./How to copy these files using one layer instead? The following was tried:
COPY [ "__BUILD_NUMBER ./", "README.md ./", "gulpfile ./", "another_file ./", ]最满意答案
COPY README.md package.json gulpfile.js __BUILD_NUMBER ./要么
COPY ["__BUILD_NUMBER", "README.md", "gulpfile", "another_file", "./"]您也可以在sourcefile规范中使用通配符。 有关详细信息,请参阅文档 。
目录是特别的! 如果你写
COPY dir1 dir2 ./实际上是这样的
COPY dir1/* dir2/* ./如果要在单个命令中复制目标目录下的多个目录(而不是其内容),则需要设置构建上下文,以使源目录位于公共父COPY ,而副本为父级。
COPY README.md package.json gulpfile.js __BUILD_NUMBER ./or
COPY ["__BUILD_NUMBER", "README.md", "gulpfile", "another_file", "./"]You can also use wildcard characters in the sourcefile specification. See the docs for a little more detail.
Directories are special! If you write
COPY dir1 dir2 ./that actually works like
COPY dir1/* dir2/* ./If you want to copy multiple directories (not their contents) under a destination directory in a single command, you'll need to set up the build context so that your source directories are under a common parent and then COPY that parent.
发布评论