Open davidjayb opened 10 months ago
It looks like a system limitation, can you issue in a privileged container echo 2 > /proc/sys/vm/drop_caches
before unmounting to see if the VM is holding any file open on the mount. Also in the compose file, maybe you can bind $HOME/mnt
, in case a reference to the host mount point is still hold by the vm.
Description
When using VirtioFS for file sharing I am unable to dynamically mount/unmount my device. If I try to start the container without the device mounted:
After mounting the device I am able to run the container. However, I am unable to unmount the device while running the container -- MacOS will warn that the device is still in use. If I force the device to be unmounted I will get a bad file descriptor until I restart the docker engine:
And this error will persist after I restart the container and/or re-mount the device. I have to restart the docker engine in order to fix the issue.
If I switch to osxfs I am able to mount and unmount at will.
Reproduce
I am connecting my Garmin watch to my docker container. A custom mount point is being used to avoid issues with the volume folder not existing under
/Volumes/GARMIN
when the container is started. Examplefstab
configuration viasudo vifs
:This will allow the device to be mounted at the
~/mnt/garmin
folder.You can then connect your watch or issue a
diskutil mount
command to an already connected device. In my case it is on disk4:Alternatively you can unmount the device and mount it without modifying your fstab configuration:
Here is my Docker Compose volume configuration:
With this configuration I should be able to start the container without the device mounted, mount the device while the container is running, and unmount the device once I am finished with it while keeping the container running.
Expected behavior
No response
docker version
docker info
Diagnostics ID
EBE543F9-393F-49F2-B1BB-FE01D27D3061/20240115002541
Additional Info
No response