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
中指定位置,它们会放在哪里?
最佳答案
这些文件不属于已构建(最终结果)镜像。
它们是传递给守护程序during the build process的构建上下文的一部分,将由Dockert指令(例如 ADD
或 COPY
或 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
管理。
关于build - 构建Docker镜像时,包含文件的默认位置是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34325540/