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
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
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
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 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>'
Someone struggling with similar issue in recent Docker releases on Mac, this helped in my case. I am using Docker version: 20.10.10 Docker Desktop: 4.2.0
In Preferences > General there is an option "Use gRPC FUSE for file sharing" which is by default checked. Uncheck that option Apply and restart.
After this for me -v option started working normally and I am able to easily share file between my Mac OS host and Docker container.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With