Search code examples
dockerdocker-for-windowsdocker-desktop

Some files not visible and other visible as folders after adding Docker volume


I couldn't start container because of some issues with volumes so I tried this to make sure I understand how volumes work. And there is something strange that is happening here. Two files should be present in /data directory but instead, I see one folder named as one of the files on the source machine. I'm doing this on Windows 10.

PS C:\Users\Piotrek\source\repos\fluentd> dir


    Directory: C:\Users\Piotrek\source\repos\fluentd


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
-a----       06.01.2019     18:50              7 abc.txt
-a----       06.01.2019     18:50             80 test.conf


PS C:\Users\Piotrek\source\repos\fluentd> docker run -ti --rm -v ${PWD}:/data ubuntu ls -alR /data
/data:
total 4
drwxr-xr-x 3 1000 root   60 Jan  6 16:48 .
drwxr-xr-x 1 root root 4096 Jan  6 17:53 ..
drwxr-xr-x 2 1000 root   40 Jan  6 16:48 test.conf

/data/test.conf:
total 0
drwxr-xr-x 2 1000 root 40 Jan  6 16:48 .
drwxr-xr-x 3 1000 root 60 Jan  6 16:48 ..

Solution

  • Problem solved. I went to Docker settings and under "Shared Drives" I clicked Reset Credentials.

    I have enabled drive sharing some time ago but after that I changed password - to no password. Looks like Docker doesn't ask you to enable drive sharing again when your password is empty. It does when you change password, but not to empty one.