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

标签 build docker include containers dockerfile

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/

相关文章:

c++ - 如何在C++中链接两个项目

java - 如何查看在 docker 容器内运行的 log4j 日志?

ruby-on-rails - rails 事件记录选择

c++ - 在 Arduino 草图中包含 .cpp 和 .h 文件的正确方法

Android源码编译错误

ios - 未提交应用以供审核

iOS 6 vs 7 外观build设置

docker - Traefik https 后端通信导致 x509 : certificate is valid for 127. 0.0.1 不是 <Container IP>

docker - Docker容器时区未传播

c - 错误 : linker command failed with exit code 1