Is there a command/option to display or list the context which is sent to the Docker daemon for building an image?
$ docker build -t "image-name"
Sending build context to Docker daemon 8.499 MB
...
Files and directories can be excluded from the build context by specifying patterns in a .dockerignore
file. I guess what I'm looking for amounts to testing the .dockerignore
in addition to any other niche rules Docker uses when determined the context.
The only way would be to add the current directory to an specific directory and list it.
Try building with this Dockerfile:
FROM busybox
RUN mkdir /tmp/build/
# Add context to /tmp/build/
COPY . /tmp/build/
Build it with:
docker build -t test .
List all the files and directories in /tmp/build:
docker run --rm -it test find /tmp/build