Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
721 views
in Technique[技术] by (71.8m points)

build - 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

As I understand it, when I execute a docker build the afolder and its contents will be included inside my docker image but where will they be placed if I do not designate a location in the Dockerfile?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Those files are not part of the built (end-result) image.

They are part of the build context passed to the daemon 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

This is managed by Context and ModifiableContext.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...