I use autofs to mount a remote folder via sshfs to my local machine. On the local machine I have a docker container running which uses the same mount as a volume.
If for whatever reason the mount is lost, the container is not able to see the volume, however as this is an autofs mount, the mount can be restored by simply accessing the appropriate folder, yet the container is not able to recover the volume, despite the mount being restored.
I would like to undertand whether there is a recommended method for determining if the mount point is restored and triggering the container to remount the volume accordingly?
I have considered using healthcheck to run a simple grep command against an expected file name in the volume, but this will only report whether the container is healthy or not, and not necessarily remount the volume.
The less elegant solution is to check whether the expected file is available through a docker exec command, try to remount the folder and restart the container. But this seems very much like a hammer approach to what is a simple problem.
Thanks a stack.