Install Seafile file sync with Docker Compose
Seafile installs on the Docker CE image with three files from the official manual: an .env file and two Compose files that start Seafile, MariaDB, a cache and a Caddy proxy that fetches the HTTPS certificate on its own. Set SEAFILE_SERVER_HOSTNAME, the admin email and passwords, start the stack, and the web interface and desktop clients connect over 443. P4 suits a team; storage, not CPU, decides when to grow.
Self-hosted apps guide, updated 2026-12-03
What makes Seafile different from other file sync tools?
Seafile stores files in libraries split into content-addressed blocks, much like Git stores objects. Sync clients only send changed blocks, which makes it quick with large folders and many small files. Each library has its own version history, and a library can be encrypted on the client so the server never sees the plain files.
The flip side is that files on disk are not plain folders you can browse with ls; you reach them through the web interface, the desktop sync client, the SeaDrive virtual drive or WebDAV. If you want a broader suite with calendars and office apps instead, the console has a Nextcloud image ready to use. Seafile has no image, so this guide installs it by hand on Docker CE.
Which plan and city should you choose?
Seafile with MariaDB and the cache runs comfortably in 2 GB of RAM for a few users; full-text search and many parallel syncs need more. Disk is the deciding factor: count today's data plus version history plus room to grow.
| Use | Plan | Specs |
|---|---|---|
| One person or a family, documents and photos | P2 | 1 vCPU, 2 GB RAM, 40 GB NVMe |
| Team of 5~25, mixed files | P4 | 2 vCPU, 4 GB RAM, 80 GB NVMe |
| Larger team or heavy media libraries | P8 | 4 vCPU, 8 GB RAM, 160 GB NVMe |
| Europe, best storage per price | S8 | 4 vCPU, 8 GB RAM, 80 GB NVMe |
Sync is very sensitive to round-trip time on many small files, so place the server where most clients are. A team in Germany fits Frankfurt or Nuremberg; a team in North America fits Ashburn or Toronto. Downloads from the server count as outgoing traffic: P4 includes 20 TB per month in Europe and 1 TB in North America, uploads are free.
Which DNS record does Seafile need?
One hostname such as files.example.com, with an A record to 203.0.113.10 and an AAAA record to 2001:db8:1234:5678::1. Create them before the first start: the Caddy container requests a certificate as soon as it runs and will fail and retry if the name does not resolve yet. Check with dig +short files.example.com from outside the server.
How do you prepare the files for Docker Compose?
Log in to a server created from the Docker CE image (or install Docker on Ubuntu 24.04 as in the Docker Compose guide) and fetch the files for the Seafile release you want. The manual hosts them in a version folder; for the 12.0 line:
mkdir -p /opt/seafile && cd /opt/seafile
wget -O .env https://manual.seafile.com/12.0/repo/docker/ce/env
wget https://manual.seafile.com/12.0/repo/docker/ce/seafile-server.yml
wget https://manual.seafile.com/12.0/repo/docker/caddy.ymlCheck the manual for a newer version folder and use the same three files from there. seafile-server.yml defines three services: db (MariaDB), memcached and seafile. caddy.yml adds the reverse proxy that handles HTTPS. Newer releases may swap the memcached service for Redis; the steps here stay the same, the cache is configured by the shipped files.
Which values in .env must you set?
Open .env and fill in at least these:
SEAFILE_VOLUME=/opt/seafile-data
SEAFILE_MYSQL_VOLUME=/opt/seafile-mysql/db
SEAFILE_CADDY_VOLUME=/opt/seafile-caddy
SEAFILE_SERVER_HOSTNAME=files.example.com
SEAFILE_SERVER_PROTOCOL=https
TIME_ZONE=Europe/Berlin
INIT_SEAFILE_MYSQL_ROOT_PASSWORD=long-random-root-password
SEAFILE_MYSQL_DB_PASSWORD=long-random-db-password
JWT_PRIVATE_KEY=output-of-pwgen-40
INIT_SEAFILE_ADMIN_EMAIL=admin@example.com
INIT_SEAFILE_ADMIN_PASSWORD=a-strong-admin-passwordGenerate random values with openssl rand -hex 32 or pwgen -s 40 1. SEAFILE_SERVER_HOSTNAME must be exactly the DNS name users type: it goes into share links, the file server URL and the certificate request. A typo here shows up later as downloads that point at the wrong address. The INIT_ values are only read on the very first start; changing them afterwards has no effect.
How do you start Seafile and create the admin user?
cd /opt/seafile
docker compose up -d
docker compose logs -f seafileThe first start takes a minute or two while the database is created. When the log shows that Seahub has started, open https://files.example.com and sign in with INIT_SEAFILE_ADMIN_EMAIL and its password. Change the password under the avatar menu, then open System Admin to add users and set quotas.
If you need another admin or forgot the password, run the bundled script inside the container:
docker exec -it seafile /opt/seafile/seafile-server-latest/reset-admin.shIt asks for an email and a new password and grants admin rights. Then install the desktop client on a laptop, add https://files.example.com as the server and sync a test library to make sure the file server path works, not only the web pages.
How does HTTPS work, and which ports are needed?
The Caddy container listens on ports 80 and 443, requests a free certificate for SEAFILE_SERVER_HOSTNAME and renews it on its own. No Certbot is needed. That also means nothing else on the host may bind to 80 or 443; if Nginx is installed, stop and disable it, or remove caddy.yml from the COMPOSE_FILE line in .env and proxy to Seafile from your own Nginx instead.
ufw allow 22/tcp
ufw allow 80/tcp
ufw allow 443/tcp
ufw enableDocker publishes container ports through its own iptables rules, so ufw does not hide a port that Compose publishes. The shipped files only publish 80 and 443, which is what you want; MariaDB and the cache stay on the internal Docker network. See the firewall guide for details.
How do you plan storage on local NVMe as the library grows?
All file blocks live under /opt/seafile-data/seafile/seafile-data on the server NVMe disk. Watch it with:
df -h /
du -sh /opt/seafile-data/seafile/seafile-dataThree things make it grow faster than the visible files: version history (each library keeps old versions for a period you set in library settings), the trash, and deleted libraries that wait for cleanup. Set a sensible history limit per library, for example 30 or 90 days, instead of keeping everything forever.
The console has no extra volumes and plans are not resized in place. When the disk fills, order a larger plan, stop the stack, copy /opt/seafile-data, /opt/seafile-mysql and /opt/seafile with rsync, update DNS and start it there. The migration guide walks through it. Leave at least 15% of the disk free; MariaDB and garbage collection need working space.
How do you run garbage collection?
Deleting a file or trimming history removes references, not blocks. Garbage collection frees the blocks nothing points to. Do a dry run first:
docker exec seafile /opt/seafile/seafile-server-latest/seaf-gc.sh --dry-runThe output lists how many blocks each library would lose. On the Community Edition the server should be stopped for the real run so no client writes blocks during it:
docker exec seafile /opt/seafile/seafile-server-latest/seafile.sh stop
docker exec seafile /opt/seafile/seafile-server-latest/seahub.sh stop
docker exec seafile /opt/seafile/seafile-server-latest/seaf-gc.sh
docker compose restart seafileAdd -r to also remove the blocks of deleted libraries. Monthly is a good rhythm for a team server; schedule it at night with a cron job.
How do you update, back up and troubleshoot Seafile?
Updates. Read the upgrade notes for the target release, then change the image tags in seafile-server.yml (or fetch the new files) and run docker compose pull && docker compose up -d. Major upgrades may ask for a one-time database step described in the notes.
Backups. Dump the databases first, then copy the data folder, in that order, so the database never references blocks the copy lacks:
docker exec seafile-mysql mariadb-dump -uroot -p"$ROOT_PW" --all-databases > /root/seafile-db.sql
restic backup /opt/seafile-data /root/seafile-db.sql /opt/seafile/.envThe optional disk backup add-on ($2.41 per month on P4) keeps 7 daily copies of the whole server; ask support in a ticket to restore one. More in backups and restore.
Troubleshooting. Web pages load but uploads fail: SEAFILE_SERVER_HOSTNAME or SEAFILE_SERVER_PROTOCOL does not match the real URL; fix .env and the file server URL under System Admin, Settings. No certificate: DNS did not resolve or port 80 was blocked; check docker compose logs caddy. Seafile container restarting: docker compose logs seafile usually names a wrong database password.
Questions about this guide
Does Seafile run on Arm servers?
Recent Seafile images are published for arm64 as well. Check the tag on the image registry for your version; Arm plans such as A8 are offered in four European cities.
Can I use WebDAV with Seafile?
Yes. Enable SeafDAV in seafdav.conf under /opt/seafile-data/seafile/conf and restart; it is served under /seafdav on the same hostname.
Is the server able to read encrypted libraries?
No. For client-encrypted libraries the password never reaches the server, so the files stay unreadable on disk. Lose the password and the library cannot be recovered.
Can I add more disk without moving servers?
There are no add-on volumes. Order a larger plan and migrate, or keep archives elsewhere with rclone as shown in adding storage with rclone or SSHFS.
How often should garbage collection run?
Monthly suits most teams. Run it after large deletions too, and always try --dry-run first.
Why do share links point to the wrong address?
The links use SERVICE_URL and FILE_SERVER_ROOT, which come from the hostname and protocol in .env. Correct those values and restart the stack.