I have a mounted volume in my docker container filesystem which is itself a mounted sshfs on my host. The thing is when (for a reason or another), my sshfs mount is lost, I also loose my volume in docker. If I reconnect my sshfs, docker can't still access to the volume. I have to restart it. How to achieve this automatically?
Asked
Active
Viewed 1,081 times
1 Answers
1
You have to mention two things if you want to reconnect to a lost sshfs-mount without restarting your container.
- Don`t mount a path which is inside your sshfs-Mount-Directory. So if your sshfs-Mount is located at /data/share/sshfs on your host-system, you should not mount this directory direct, instead use on directory above (/data/share)
- You have to mount your directory with the propagation-mode "rshared" (default rprivate will not work)
Syntax:
docker run -v [SOURCE: ONE ABOVE SSHFS-MOUNT]:[DESTINATION]:rshared [IMAGE]
Example:
docker run -v /data/share/:/data/share/:rshared ubi8:latest

C_o_H
- 63
- 1
- 6