How does .dockerignore
handle exceptions?
For example, I would like to ignore everything from the src/
directory except for src/web/public
.
I've tried...
.git
src
!src/web/public
Seems to not work.
docker build .
shows Sending build context to Docker daemon 20.63 MB
either way.
It does not appear that
.dockerignore
handles exceptions. If there is a well-known syntax for this, you could propose the change and make a pull request.In tag 1.3 of commands.go we see this:
and in archive.go:
Just wanted to add in case others run into this question, that from docker 1.7.0 exclusions are supported in the .dockerignore file. So the example
!src/web/public
in the question actually workshttps://docs.docker.com/engine/reference/builder/#dockerignore-file
Using my response to another question https://stackoverflow.com/a/51429852/2419069 you can use the following
.dockerignore
file: