【问题标题】:What is the default location for included files when building a docker image?构建 docker 映像时包含文件的默认位置是什么?
【发布时间】:2015-12-17 02:15:22
【问题描述】:
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 中指定位置,它们将被放置在哪里?

【问题讨论】:

  • 我已经尝试过这个作为实验,然后在新建的图像中搜索,但无法找到文件。

标签: build docker include containers dockerfile


【解决方案1】:

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

它们是传递给守护进程during the build process 的构建context 的一部分,供ADDCOPYRUN 等Dockerfile 指令使用。

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

中的文件

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

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

这是由Context and ModifiableContext管理的。

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2023-03-27
  • 2011-07-06
  • 1970-01-01
  • 2015-01-21
  • 2019-09-13
  • 1970-01-01
  • 2011-09-24
相关资源
最近更新 更多