Docker volumes & case insensitive directories

On OSX and Windows, as you might know, directories are case insensitive. So the directory CaseSensitive and casesensitive are the same on those operating systems. But on Linux, they are different directories.

The interesting thing about this is, that when you use docker and attach a volume to the container from OSX or Windows, that directory will be case insensitive. While other directories within the container are case sensitive (because it runs Linux). Which makes perfect sense, as the directory in the volume is managed by your own OS.

A small demonstration:

So on my own machine I have a directory blog/CaseSensitiveTest with a file somefile. When I run an alpine container, and attach it as a volume, you can see its contents. Next I create a directory test/CaseSensitiveTest¬†with the file someotherfile. Then I try to list its contents using the different names: CaseSensitiveTest works, and casesensitivetest doesn’t work.

But if I try to list the contents of the volume, using casesensitivetest, it works! So this is something to keep in mind when working with Docker, would have saved me a lot of time when debugging.

Author Deniz Turan

Java Developer at JCore, with a passion for full stack development and technology, and a love for games, tv shows, and cars.

More posts by Deniz Turan