本文介绍了添加Docker卷后,一些文件不可见,另一些文件作为文件夹可见的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于的某些问题,我无法启动容器,因此我尝试执行此操作以确保了解卷的工作方式.而且这里发生了一些奇怪的事情. /data目录中应该存在两个文件,但是,相反,我看到一个文件夹被命名为源计算机上的文件之一.我正在 Windows 10 上执行此操作.

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 ..

推荐答案

问题已解决.我转到Docker设置,然后在共享驱动器"下单击重置凭据".

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

我前段时间启用了驱动器共享,但是之后我更改了密码-更改为无密码.密码为空时,Docker似乎不要求您再次启用驱动器共享.更改密码时会执行此操作,但不要将其清空.

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.

这篇关于添加Docker卷后,一些文件不可见,另一些文件作为文件夹可见的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 22:36