Search code examples
dockerdockerfiledocker-builddockerignore

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


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.


Solution

  • 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