I know I can put a .dockerignore
file in the same directory as the dockerfile
to ignore some patterns, and this works. Docker doesn't seem to see .dockerignore
files recursively down in the directory structure though.
I've got a directory which is a git submodule. I'd like to add things to a .dockerignore
file down in the submodule so that multiple projects that use this shared repo can inherit it.
Is there a way to manually include a .dockerignore
file into the current context in the dockerfile
?
You can not include by reference the
.dockerignore
file form the submodules.The
.dockerignore
is usually related to a specific development tools and methods, so there is a good chance that the.dockerignore
will already cover some of the major common files in the submodule as it covers in the main repository.In case where there are discrepancies, you can add the content from the submodule .dockerignore to your main .dockerignore, corrected for the prefixes that are relevant to the submodule.