I recently reconfigured my nextcloud AIO docker instance to get files from a local bind mount instead of a network share. I needed to mount the files with the www-data user (id 33) so nextcloud would properly read and write to them. The procedure of making a fuse mount with force-user and force-group as outlined in the readme did the trick.
However, it did not survive a reboot. The directory I want to expose to the nextcloud container is a ZFS dataset. There is some sort of race condition where the fuse filesystem sometimes binds to the empty mount directory before the dataset is mounted. To fix this, I needed to make the mount process its own systemd unit file, instead of an fstab entry. This is how I got it to work:
cat /etc/systemd/system/nextcloud-mount.service
[Unit]
Description=bindfs mirror /mnt/storage -> /mnt/nextcloud_storage
RequiresMountsFor=/mnt/storage
After=local-fs.target remote-fs.target
[Service]
Type=forking
ExecStart=/usr/bin/bindfs -u 33 -g 33 /mnt/storage /mnt/nextcloud_storage
ExecStop=/bin/umount -l /mnt/nextcloud_storage
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
After writing that file, doing systemctl daemon-reload and systemctl enable nextcloud-mount my problem was solved! The bind mount only happens after all local and remote filesystems are mounted.