使用osxfs的mac docker卷挂载不起作用 [英] mac docker volume mount using osxfs not working
问题描述
适用于Mac的Docker桌面开始使用osxfs
来支持在MacOS上进行卷挂载.根据其页面,这样的命令应该挂载~/Desktop
指向Docker容器的目录:
Docker Desktop for Mac started using osxfs
for supporting volume mounting on MacOS. According to their page, a command like this should mount the ~/Desktop
directory to the docker container:
docker run -it -v ~/Desktop:/Desktop r-base bash
尽管我确实看到了Desktop
目录,但其内容为空:
Although I do see a Desktop
directory as expected, its contents are empty:
root@80cb534e4eeb:/# ls
bin boot Desktop dev etc home lib lib64 media mnt opt proc root run sbin srv sys tmp usr var
root@80cb534e4eeb:/# ls Desktop/
root@80cb534e4eeb:/# exit
exit
而本地Desktop
目录中肯定有文件
while there are definitely files in the Desktop
directory locally
Users-MacBook-Pro:~ user$ ls Desktop/
Screen Shot 2019-03-25 at 10.34.58.png Screen Shot 2019-03-25 at 22.26.10.png Screen Shot 2019-03-27 at 07.34.55.png
Screen Shot 2019-03-25 at 10.35.59.png Screen Shot 2019-03-25 at 22.26.11.png Screen Shot 2019-03-28 at 15.14.48.png
Screen Shot 2019-03-25 at 22.26.08.png Screen Shot 2019-03-25 at 22.47.32.png Screen Shot 2019-04-05 at 09.26.12.png
Screen Shot 2019-03-25 at 22.26.10 1.png Screen Shot 2019-03-27 at 07.34.33.png
应根据首选项"窗口访问/Users
目录.似乎docker配置有问题,但是我还没有发现任何类似的问题.与osxfs
相关的大多数问题都与IO性能有关.关于如何进一步解决/调查此问题的任何想法?
The /Users
directory should be accessible according to the Preferences window. Seems like something is wrong with the docker configuration, but I haven't found any similar issues reported yet. Most issues related to osxfs
are about IO performance. Any ideas on how to further solve/investigate this issue?
推荐答案
在首选项中Docker恢复出厂设置已解决了该问题,但根本原因仍然未知.解决此类问题的一种方法是批量安装Docker for mac使用的linux VM的根目录,然后四处寻找.可以通过以下方式完成:
Docker factory reset in the preferences fixed the issue but the root cause is still unknown. One way of troubleshoot this kind of issues is to volume mount the root of the linux VM used by Docker for mac and poke around. This can be done with:
docker run --rm -v /:/vm_root --entrypoint=sh alpine -c 'ls -l /vm_root/<path in macOS>'
这篇关于使用osxfs的mac docker卷挂载不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!