Rclone In Docker Compose Configuration

I have decided to use docker vs systemd to run rclone, I don't want to mess with systemd, plus systemd is harder to migrate and backup.

So this is the compose file I have came up with:

version: '3.3'
services:
    rclone0:
        image: rclone/rclone:latest
        volumes:
            - ./config:/config/rclone
            - ./data:/data:shared
            - /etc/passwd:/etc/passwd:ro
            - /etc/group:/etc/group:ro
            - /etc/fuse.conf:/etc/fuse.conf:ro
        devices:
            - /dev/fuse:/dev/fuse:rwm
        cap_add:
            - SYS_ADMIN
        security_opt:
            - apparmor:unconfined
        user: 1000:1000
        network_mode: npm_default
        container_name: rclone0
        command: 'serve sftp xxx: --addr :8080 --user xxx --pass xxx --vfs-cache-mode full --cache-dir=/data/cache/0'

    rclone1:
        image: rclone/rclone:latest
        volumes:
            - ./config:/config/rclone
            - ./data:/data:shared
            - /etc/passwd:/etc/passwd:ro
            - /etc/group:/etc/group:ro
            - /etc/fuse.conf:/etc/fuse.conf:ro
        devices:
            - /dev/fuse:/dev/fuse:rwm
        cap_add:
            - SYS_ADMIN
        security_opt:
            - apparmor:unconfined
        user: 1000:1000
        container_name: rclone1
        command: 'mount xxx: xxx --allow-other --vfs-cache-mode full --cache-dir=/data/cache1'

While this works fine for the most part, if rclone is met with an error, it does not restart. What is a config line I can add to the compose file to make the restart happen?

Secondly, I always encounter the transport endpoint disconnected error. Be it cancelling a rsync operation writing into the mounted path or restarting the container. Is there a way to avoid this error? I wanted to use the fusermount -u /path option, but 1, compose does not seem to be able to execute commands on stop, 2, this really isn't solving the problem if something else is still writing to the directory.

So in the second case, is there a way to make sure rclone can mount properly again without having to stop the writing operation? So after it mounts rclone will continue to write or read those files.

I will take another approach towards this problem. Closed.