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

What is the default location for included files when building a docker image?

derrend@laptop ~/topdir $ docker version
Client version: 1.7.1
Client API version: 1.19
Go version (client): go1.4.2
Git commit (client): 786b29d
OS/Arch (client): linux/amd64
Server version: 1.7.1
Server API version: 1.19
Go version (server): go1.4.2
Git commit (server): 786b29d
OS/Arch (server): linux/amd64

derrend@laptop ~/topdir $ pwd; ls *
$HOME/topdir
Dockerfile

afolder:
afile

据我了解,当我执行 docker build 时,afolder 及其内容将包含在我的 docker 图像中,但如果我不指定它们将放置在何处Dockerfile?

中的位置

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

它们是构建 context 传递给守护进程 during the build process, to be used by Dockerfile directives like ADD or COPY or RUN 的一部分。

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

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

这由 Context and ModifiableContext 管理。