Log inSign up

Seafile file sync and sharing on a Docker host

Download the official Seafile Community Edition Compose files (.env, seafile-server.yml and caddy.yml), fill in your host name, passwords and a JWT key, then run docker compose up -d. The bundled Caddy container fetches a Let's Encrypt certificate for the host name, MariaDB stores the metadata, and your libraries live under /opt/seafile-data.

Topic: Self-hosted apps · Tested on: Ubuntu 24.04 and 22.04, Debian 12 and 13 · Updated 2026-12-03

Why choose Seafile and what does it need?

Seafile focuses on fast, reliable file sync: files are split into blocks and stored in libraries with their own history, which keeps sync quick even for folders with many small files. The web interface handles sharing links, groups and per-library encryption.

Prepare these first:

  • Ubuntu 24.04 or Debian 12/13 with Docker Engine and the Compose plugin. Deploying the Docker app image covers that, or follow the Docker install tutorial.
  • A host name, for example drive.example.net, with A and AAAA records already pointing at the server.
  • About 2 GB of memory for a small group, since MariaDB, a cache and the Seafile services run side by side.
  • Ports 80 and 443 free, because the bundled Caddy container listens on both.

How do you fetch the official Compose files?

The Seafile admin manual publishes ready Compose files per major version; download the set for the version you want into /opt/seafile.

sudo mkdir -p /opt/seafile && cd /opt/seafile
BASE=https://manual.seafile.com/13.0/repo/docker
sudo wget -O .env $BASE/ce/env
sudo wget $BASE/ce/seafile-server.yml
sudo wget $BASE/caddy.yml
ls -la

Paths in the manual have moved between major versions, so copy the three links from the Docker CE install page for your chosen release if the commands above return 404. The .env file wires the YAML files together through its COMPOSE_FILE line, which is why a plain docker compose later picks up all of them.

Which settings go into the .env file?

Edit the host name, protocol, passwords, time zone, admin login and a random JWT key; the rest can keep its defaults.

openssl rand -base64 40 | tr -d '\n'; echo
sudo nano /opt/seafile/.env

The values to change look like this (names can differ slightly between versions, so follow the comments in your file):

SEAFILE_VOLUME=/opt/seafile-data
SEAFILE_MYSQL_VOLUME=/opt/seafile-mysql/db
SEAFILE_CADDY_VOLUME=/opt/seafile-caddy
TIME_ZONE=Etc/UTC
JWT_PRIVATE_KEY=paste-the-random-string
SEAFILE_SERVER_HOSTNAME=drive.example.net
SEAFILE_SERVER_PROTOCOL=https
INIT_SEAFILE_MYSQL_ROOT_PASSWORD=long-random-root-secret
SEAFILE_MYSQL_DB_PASSWORD=long-random-app-secret
INIT_SEAFILE_ADMIN_EMAIL=admin@example.net
INIT_SEAFILE_ADMIN_PASSWORD=long-random-admin-secret

The variables that start with INIT_ are read only on the first start. Changing them later does nothing; change the admin password from the web interface instead. Keep the file private with sudo chmod 600 /opt/seafile/.env.

How do you start Seafile and confirm it works?

Open the firewall for web traffic, bring the stack up and watch the Seafile container log until the services report that they have started.

sudo ufw allow OpenSSH
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable
cd /opt/seafile
sudo docker compose up -d
sudo docker compose ps
sudo docker logs -f seafile

The first start creates the three databases (ccnet_db, seafile_db and seahub_db) and the admin account, which takes a minute. Then check HTTPS from the server itself:

curl -I https://drive.example.net/accounts/login/

A 200 response with a valid certificate means Caddy, Seahub and the file server all answer. Sign in with the admin email and password from .env. If the certificate is missing, look at sudo docker logs seafile-caddy; the cause is nearly always DNS that does not yet point at this server.

How do you connect the desktop and mobile clients?

Install the Seafile desktop client or the SeaDrive virtual drive on each computer, enter https://drive.example.net as the server, and sign in with a user account.

Create users under System Admin, Users, or let people sign up if you enable that in the admin settings. A library is the unit of sync: create one per project or per person, choose whether it is encrypted on the client side, and share it with groups. Client-side encrypted libraries keep their password away from the server, so the admin cannot reset it; store those passwords carefully.

Phones use the Seafile app with the same address. Upload limits for the web interface can be raised later in seahub_settings.py with FILE_UPLOAD_SIZE_LIMIT, though the clients upload in blocks and are not affected.

How do you set up outgoing mail?

Add Django mail settings to seahub_settings.py and restart the stack, pointing them at an authenticated relay on port 587.

sudo nano /opt/seafile-data/seafile/conf/seahub_settings.py

EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.example.net'
EMAIL_HOST_USER = 'drive@example.net'
EMAIL_HOST_PASSWORD = 'change-me'
EMAIL_PORT = 587
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
SERVER_EMAIL = EMAIL_HOST_USER

cd /opt/seafile && sudo docker compose restart

Seafile uses mail for share notices and password resets. Sending straight to recipient servers over port 25 is not guaranteed from a VPS, so open a ticket with support before you depend on it; a relay account avoids the question entirely. See SMTP relay for apps for the sender setup and the DNS records that keep mail out of spam folders.

How do you back up, clean up and upgrade Seafile?

Back up the databases first and the data folder second, run garbage collection now and then, and upgrade by pulling new images within a major version.

sudo docker exec seafile-mysql mariadb-dump -uroot -p'long-random-root-secret' --opt --databases ccnet_db seafile_db seahub_db > /root/seafile-db-$(date +%F).sql
sudo rsync -a /opt/seafile-data/ /root/seafile-data-copy/
sudo docker exec seafile /opt/seafile/seafile-server-latest/seaf-gc.sh --dry-run
sudo docker exec seafile /opt/seafile/seafile-server-latest/seaf-gc.sh

Dumping the databases before copying the data means the block store always contains everything the dump refers to. Garbage collection removes blocks no longer referenced by any library history; run the dry run first to see how much it would free. In older releases the container name for the database may be seafile-mysql or mysql, so confirm it with docker compose ps.

For upgrades within the same major version: sudo docker compose pull && sudo docker compose up -d. For a new major version, download that version's Compose files and follow its upgrade notes, which sometimes add or rename variables. Copy backups off the server and add the daily backup add-on if you want a disk image as well.

What should you check when Seafile misbehaves?

Read the logs inside the data volume: /opt/seafile-data/logs/ holds seafile.log and seahub.log, which name the failing part.

  • Clients cannot sync but the web works: SEAFILE_SERVER_HOSTNAME or the protocol in .env does not match the address clients use.
  • Database connection refused: the MariaDB container is still starting or ran out of memory; check docker stats.
  • Library corruption warnings: run seaf-fsck.sh inside the container on the library ID shown in the log.
sudo tail -n 50 /opt/seafile-data/logs/seafile.log
sudo docker exec seafile /opt/seafile/seafile-server-latest/seaf-fsck.sh

Plans that fit this guide

Base city prices. Every plan includes a dedicated IPv4 address, IPv6, full root and all 18 images.

All prices
PlanFits becauseSizeMonthlyOrder from
A2-2personal or small family use2 vCPU, 2 GB RAM, 60 GB NVMe$10.80/mo$64.80 for 6 months
A2-4team libraries with several clients2 vCPU, 4 GB RAM, 100 GB NVMe$14.40/mo$43.20 for 3 months
A4-8many users and heavy sync4 vCPU, 8 GB RAM, 180 GB NVMe$28.80/mo$86.40 for 3 months

Questions about Seafile file sync

Can Seafile use my existing Nginx instead of the bundled Caddy?

Yes. Remove caddy.yml from COMPOSE_FILE, publish the Seafile container port on 127.0.0.1 only, and proxy to it from Nginx with a Certbot certificate. The manual has a section on running without the bundled proxy.

Is Seafile a replacement for Nextcloud?

It covers file sync and sharing, and does that very well. Calendar, contacts and chat are not part of it, so pick Nextcloud if you need those in one place.

How much disk do I need?

Plan for your files plus file history. Seafile keeps old versions according to each library history setting, so shorten that setting on large libraries if disk is tight.

Does Seafile support two-factor login?

Yes, the community edition includes TOTP two-factor authentication. Enable it under System Admin, Settings, then each user turns it on from their profile.

What happens if I lose an encrypted library password?

The server cannot recover it, because the key never leaves the client in usable form. Keep those passwords in a password vault.