Files in a mounted hidden directory are not visible

Platform: Fedora

On host, I have the following files

/a/.b/c/d/1.txt
/a/.b/c/d/2.txt

when I run the following

docker run --rm -v /a:/a gcc:10-buster ls -la /a/.b/c/d

Actual Output:
drwxr-xr-x 2 root root 6 Oct 30 16:38 .
drwxr-xr-x 3 root root 31 Oct 30 16:38 …

Expected output:
drwxr-xr-x 2 root root 6 Oct 30 16:38 .
drwxr-xr-x 3 root root 31 Oct 30 16:38 …
drwxr-xr-x 4 root root 1024 Oct 30 16:38 1.txt
drwxr-xr-x 5 root root 1024 Oct 30 16:38 2.txt

i.e, folders coming from a hidden directory are visible, but files are not visible inside the container.

How can I mound a hidden directory correctly?

1 Like

How did you install Docker? Official Docker would not care about “hidden” folders. That is just a folder starting with a dot wich is hidden on Linux by default.

Are you using Docker Desktop for Linux or Docker CE?

I am also facing the same issue
Platform: Mac OS
Version 4.16.2 (95914)
Installed Docker desktop

That should work too, but you can check if you are using the virtiofs filesharing implementation (general settings). It is usually recommended to use that instead of the legacy solutions.

1 Like

Thanks… That worked for me.