Search code examples
linuxwindowsdockercontainersmount

Is there a way I can bind mount dot files from a windows host to a linux container?


I am attempting to mount a file from my Windows (Host) to my Linux (Container). When I mount a single file with a standard extension, everything seems to work fine. However, when I attempt to mount a single file that is a dot-file, it does not work.

//This does not work
type=bind,source=${env:USERPROFILE}\\.sample,target=/home/.sample,consistency=cached

// This does work
type=bind,source=${env:USERPROFILE}\\sample.txt,target=/home/sample.txt,consistency=cached

I'm not sure how to specify that the file is a dot file. I did notice that if the file did not exist, a folder named .sample was created on my Windows (Host) machine, but that same folder was not created on Linux (Container).


Solution

  • Are you sure they aren't there? Linux treats dotfiles as hidden files, so they aren't visible by just doing an ls command.

    You can use ls -A which should show you the hidden dotfiles.