Can we control case sensitivity of contents in .dockerignore file?

Viewed 510

In the official documentation I could not find information regarding case sensitivity of contents in the .dockerignore file.

Can we control case sensitivity of contents in .dockerignore file?

For example: I have file extension like .txt, .TXT, .Txt - I would like to single specify pattern.

2 Answers

It seems like the .dockerignore file is case-insensitive on Windows and case-sensitive on Linux (and thus likely MacOS).

From the Docker documentation:

The CLI interprets the .dockerignore file as a newline-separated list of patterns similar to the file globs of Unix shells. [...] Matching is done using Go’s filepath.Match rules. A preprocessing step removes leading and trailing whitespace and eliminates . and .. elements using Go’s filepath.Clean.

It seems like aforementioned functions make use of Go's glob, which is case-insensitive or case-sensitive depending on your operating system

It's Monday 20 Sept 2021 and .dockerignore files appear to be case-sensitive on Windows. I had to change one of my exclusion rules from !obj\Docker\program* to !obj\Docker\Program*

I'm using VS 2019 (version 16.11.3) along with VS Tools for Containers 1.0 and VS Container Tools Extensions 1.0.

Related