8.0.3 docker. Please help with storing data outside the docker


I am deploying Seafile using docker in a Ubuntu 20.04 DigitalOcean droplet. In that droplet I also have a blockstore volume attached for extra storage, I mounted it at /mnt/shared.

After reading Seafile documentation I expected that if I set:
/opt/seafile-data:/mnt/shared in the docker-compose.yml then Seafile would store all the data outside the docker filesystem, in the server filesystem at /mnt/shared. However Even if everything seems to work perfectly and I can upload files, I don’t see anything under /mnt/shared, the folder is empty. Actually I have no idea of where the data is stored. If I look for example for seafile.log:

root@files:/# locate seafile.log

and there is nothing in /opt/seafile-data/

root@files:/opt/seafile-data# ls -a
.  ..

I am afraid that this is just me not knowing exactly how docker works. I would also expect the database to be located at /var/lib/mysql but there is nothing there and however there are data/files at /opt/seafile-mysql
Please let me know how can I find out where the files are stored and how would I be able to store the data/files outside the docker instance, in the /mnt/shared folder of the server.

Here is my docker-compose.yml:

version: '2.0'
     image: mariadb:10.5
     container_name: seafile-mysql
       - MYSQL_ROOT_PASSWORD=[password]
       - MYSQL_LOG_CONSOLE=true
       - /opt/seafile-mysql/db:/var/lib/mysql
       - seafile-net

      image: memcached:1.5.6
      container_name: seafile-memcached
      entrypoint: memcached -m 256
        - seafile-net
     image: seafileltd/seafile-mc:latest
     container_name: seafile
        - "80:80"
        - "443:443"
        - /opt/seafile-data:/mnt/shared
        - DB_HOST=db
        - DB_ROOT_PASSWD=[password] 
        # - TIME_ZONE=Etc/UTC
        - SEAFILE_ADMIN_EMAIL=[email]
        - SEAFILE_ADMIN_PASSWORD=[password]
        - SEAFILE_SERVER_HOSTNAME=[domain]
        - db
        - memcached
        - seafile-net


I’m interested in your progress as I am wanting to do the same thing tomorrow morning. Which installation guide did you follow?

@m_elias looks like I can’t add links to my posts, weird.

For now I used the following DigitalOcean tutorials:
the tutorial how-to-install-and-use-docker-on-ubuntu-20-04
and ufw-essentials-common-firewall-rules-and-commands (I opened ports 80 and 443)

Then I created a volume in DigitalOcean, attached it to my droplet, and mounted it in /mnt/shared

Then from the Seafile documentation I looked at the page “Deploy Seafile with Docker” where they provide an example for the docker-composer.yml file, and I created the docker-compose.yml file that I added in my previous post.

Then I just run the docker using
docker-compose up -d

That’s all until now.

So it is fixed now. @m_elias
The problem was that I was incorrectly using the paths inside “volumes:”. Basically you have

So when I was doing:


I was actually trying to attach the container path /mnt/shared to my host path /opt/seafile-data. Which is the opposite than what I wanted to do. So the right thing to do is:


Which attach the container /shared folder to the host folder /mnt/shared/seafile-data, and /mnt/shared is the folder in which I mounted the Digital Ocean blockstore volume. And in the same way you can also move the database to the blockstore volume:


@diegosb Thanks for clarifying that. It appears to have worked for me, other then being a docker-compose noob, I wasn’t sure where to put the docker-compose.yml file and I didn’t realize I needed sudo for starting docker-compose. I just created ~/seafile_compose dir and put the yaml in there.

I notice this guide doesn’t mention enabling Docker auto start at boot up nor does it mention any container restart policy.

I used systemctl enable docker so that Docker at least starts up when the VM [re]boots but I’m not sure where in the yaml to place restart: always

Just like they suggest here https://serverfault.com/questions/884759/how-does-restart-always-policy-work-in-docker-compose I tried adding the line:

restart: always

in each service defined in the yaml. It worked, I tried to reboot the machine and the services are back up.

One thing to consider is to change image: foo.bar:latest to use a version tag instead of the latest tag.