且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

构建 docker 映像时,包含文件的默认位置是什么?

更新时间:2022-11-30 15:12:50

这些文件不是构建(最终结果)图像的一部分.

Those files are not part of the built (end-result) image.

它们是传递给守护进程在构建过程中,供 Dockerfile 指令使用,例如 添加COPYRUN.

They are part of the build context passed to the daemon during the build process, to be used by Dockerfile directives like ADD or COPY or RUN.

构建的上下文是位于指定 PATH 或 URL

A build’s context is the files located in the specified PATH or URL

例如,运行此命令以使用分支容器中名为 docker 的目录:

For example, run this command to use a directory called docker in the branch container:

$ docker build https://github.com/docker/rootfs.git#container:docker

这是由 ContextModifiableContext.

This is managed by Context and ModifiableContext.