1
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?

derrend
  • 4,176
  • 4
  • 27
  • 40
  • I have tried this as an experiment and then searched inside of the newly built image but have been unable to find the files. – derrend Dec 17 '15 at 02:17

1 Answers1

1

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.

Community
  • 1
  • 1
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • Note to self: That was my **14000th answer** on Stack Overflow (in 87 months), less than 5 months after the [13000th answer](http://stackoverflow.com/a/31640408/6309). Before that, [12000th answer](http://stackoverflow.com/a/28412501/6309); [11000th answer](http://stackoverflow.com/a/25821796/6309), [10000th answer](http://stackoverflow.com/a/23909654/6309), [9000th answer](http://stackoverflow.com/a/20683667/6309), [8000th answer](http://stackoverflow.com/a/17569094/6309), [7000th answer](http://stackoverflow.com/a/14274272/6309), [6000th answer](http://stackoverflow.com/a/11644343/6309),... – VonC Dec 17 '15 at 11:23