build - 构建Docker镜像时,包含文件的默认位置是什么?

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指令(例如 ADDCOPYRUN )使用。

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 管理。

https://stackoverflow.com/questions/34325540/

相关文章:

docker - 在MacOS上使用docker作为提供程序的游民,无法在容器中挂载目录

docker - 使用criu进行Docker容器迁移

docker - 如何在Docker中设置用于--link选项的容器名称

windows - Boot2Docker:无法创建目录:协议(protocol)错误

windows - Docker无法处理Dockerfile

docker - Docker传递环境变量

google-app-engine - 使用自定义运行时在托管VM上的Ubuntu

docker - Rancher imageUuid 不是唯一的

docker - Travis未缓存目录

ubuntu - Docker:系统错误:无法创建 pivot_root 目录