Seafile backup step-by-step how-to, plus: Co-existing with NextCloud, auto-mounting seaf-fuse with Docker

Here is a smoother way to make the seaf-fuse mount point auto-start within the container:

Step 1 is to add a new “bind” volume to seafile in the Docker Compose file. See the full .yml file above, but here is the relevant section:

[services:
...
   seafile:
...
    volumes:
...]
      - type: bind
        source: /mnt/seafile-archive/
        target: /seafile-fuse/
        bind:
          propagation: rshared
  • Note that bind volumes do not work in Docker Desktop. I previously tried to run Seafile under Windows/WSL and Docker Desktop. This was the failure point. The solution was to install Ubuntu in a Hyper-V virtual machine instead, and run Docker/Seafile from there.

Now we need to run seaf-fuse.sh start /seafile-fuse/ within the Docker container. Here is a smoother way to accomplish that, that only requires make a small change to the Docker Compose .yml. Add the following line to your docker-compose.yml:

[services:
...
   seafile:
...
       command: sh -c "(sleep 15 && /opt/seafile/seafile-server-latest/seaf-fuse.sh start /seafile-fuse)& /sbin/my_init -- /scripts/enterpoint.sh"
...

The second part of the command (/sbin/my_init -- /scripts/enterpoint.sh) is just the normal initial command for the Seafile docker container.

The first part - (sleep 15 && /opt/seafile/seafile-server-latest/seaf-fuse.sh start /seafile-fuse)& - waits 15 seconds, then starts seaf-fuse.sh in a background thread.

In your logs you can verify that this command run - look for output like this:

seafile  | Starting seaf-fuse, please wait ...
seafile  | seaf-fuse started
seafile  |
seafile  | Done.

One possible future issue: If Seafile ever changes the init script for the container (to something besides enterpoint.sh then this script will fail and require some tweaking. However, enterpoint.sh seems to be a standard initial command for Docker containers, so it seems unlikely to change. Even if it does change in a future version, the required changes to the Compose file should be relatively simple. The basic idea here is to add another shell command in addition to the one used to start the container.

Again, there may be a smoother way to accomplish this - and I would love to hear about them from anyone who cares to share. But this is fairly simple, robust, and portable in the sense of requiring only a few lines in the Docker Compose file rather than twiddling with internal files in the container itself.