Docker, FUSE and host mounted rclone

I’ll preface this by knowing this isn’t strictly an rclone issue, or even a FUSE issue, however this forum has a high concentration of people using rclone on the host with docker containers reading the data.

Has anyone worked out if docker can remount a fuse mount that disconnects? Sometimes rclone mount fails for whatever reason and doesn’t automatically reconnect, so I have a script to check connectivity and remount if it fails the test.

The issue is that remounted or new FUSE mounts on the host aren’t then forwarded to existing running docker containers.

Has anyone had any experience mitigating this? I’ve managed it before by adding a unionFS layer on top of the network mount which seems to prevent docker issues but it’s added complication now there’s a working write/read cache so I no longer mount rclone with RO flags.

1 Like

I can see why the unionFS mitigates the problem as it keeps the filesystem presented to docker constant. So that is a possible solution.

Otherwise I don’t really have any ideas other than searching docker issues to see if someone else has had the same problem as it sounds like it might be a bug to me…

I had the same issue a while ago.

The solution is to pass a custom bind mount to docker. Let’s say you want pass /mnt/rclone into a docker container.
The docker command looks like this:

docker run --mount type=bind,source=/mnt,destination=/mnt,readonly,bind-propagation=rslave image

This will bind your /mnt folder into the container in slave mode.
Once rclone dies the the fuse mount /mnt/rclone is recreated the container can access the new mount point, because it has still access to /mnt.
readonly is optional, I left it in to show its possible.
The important part is bind-propagation=rslave.

If you want to know why it’s working I recommend the mount(8) man page or the kernel documentation for sharedsubtree’s.

By default docker is using a bind-propagation=rprivate which prevents any mount changes on the host to be visible in the container and vice versa.
bind-propagation=rslave allows the container to see changes on the host, but it can not change them.


This is great and exactly why I asked here. Will experiment!
Will need to wait as deluge is rehashing a stack of seeding torrents that reported an error when the mount died. (Obviously it came back a minute later but doesn’t change the fact it’s marked needing to be checked and it takes a while!)