Excluding all hidden files with .dockerignore

I am trying to exclude from the Docker image all hidden files (starting with a dot) from all project directories.

To exclude .git and .gitingore : .git*

To exclude all .keep files: **/.keep works

For all hidden files, I tried: **/.* , But this excludes all files containing a period, for example **/*.* .

+5
source share
2 answers

. Dockerignore files try to follow Go filepath.Match with the addition of a glob type ** , matching any directories in the path. Thus, they are not quite the same as globe templates or even try to be. In fact, Docker implemented its own parser so that it doesn't even use filepath.Match .

Using dir/.* and dir/*/.* works as expected. But dir/**/.* does not seem to work all the time.

This particular problem needs to be resolved , but I think I saw the same behavior in 1.13.1 in certain circumstances.

So, with .dockerignore of dir/**/.* dir/file.ext will be excluded, but dir/subdir/file.ext will be included.

It might be worth opening a new problem with Docker if you have a specific reproducible case in version 1.13

+2
source

The problem has been fixed, but the commit has not yet been merged into a freed branch.

0
source

Source: https://habr.com/ru/post/1264595/


All Articles