gpt4 book ai didi

Dockerfile,如何从父目录复制文件

转载 作者:行者123 更新时间:2023-12-04 11:33:14 53 4
gpt4 key购买 nike

我有包含多个 docker 图像通用文件的文件夹。我该怎么办 COPY这些文件指向引用 Dockerfile 中父目录的图像?显然我不想将此文件夹复制到所有 Docker 项目中。

最佳答案

当您运行时 docker build最新的参数被称为 PATH .这是来自 here 的描述:

The docker build command builds Docker images from a Dockerfile and a “context”. A build’s context is the set of files located in the specified PATH [omissis]. The build process can refer to any of the files in the context. For example, your build can use a COPY instruction to reference a file in the context.


这意味着你必须指定一个 PATH包含您在 Dockerfile 中需要的所有文件。请注意更改 PATH到不同的目录将需要更改您的所有 COPYADD反射(reflect)新目录结构的说明。

关于Dockerfile,如何从父目录复制文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50618073/

53 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com