1. Home
  2. Linux
  3. Deploy seafile in docker on ubuntu server

Deploy SeaFile in Docker on Ubuntu Server

SeaFile is a file-syncing and collaboration platform tool for teams. With it, you can make it very easy to share files and folders with teams, and anyone else too. In this guide, we’ll go over how you can quickly deploy SeaFile inside of Docker on Ubuntu Server.

Note that SeaFile requires servers with a decent amount of storage space. Before attempting to install SeaFile, ensure you have adequate space to handle files uploaded to it.

The hero image for SeaFile in Docker.

How to install Docker on Linux

Before you can set up SeaFile in Docker on your Ubuntu Server, you need to set up the latest version of Docker. If you don’t have Docker on Ubuntu Server, you won’t be able to get this service running. Here’s how to do it.

sudo apt install apt-transport-https ca-certificates curl software-properties-common

Following the installation of these packages, proceed to add the GPG key that grants access to Docker’s software repository on Ubuntu. You can do this by running the following command.

curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -

With the GPG key successfully added, it is time to enable the official Docker software repository. This is a critical step for installing Docker CE, which is essential for running Seafile. Incorporate the repository using the command:

sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"

After setting up the repository, you need to update your software sources to reflect the changes.

sudo apt update

Having completed the initial setup steps, your Ubuntu Server is now primed for Docker installation. Finish up the installation process by installing the latest Docker package.

sudo apt install docker-ce

This streamlined guide ensures your Ubuntu Server is efficiently prepared for hosting a Seafile server container through Docker installation.

How to create a SeaFile compose file

The SeaFile default file view.

Deploying SeaFile on Linux is best done with Docker Compose. To start, open up a terminal, then, use the touch command to create a new “docker-compose.yml” file.

touch docker-compose.yml

After you’ve created the new file, open up the new file with the Nano text editor.

nano docker-compose.yml

Copy the code below into the Nano text editor in its entirety. Then, press Ctrl + O to save it. Once you’ve saved it, it is time to begin editing.

version: '2.0'
services:
  db:
    image: mariadb:latest
    environment:
      - MYSQL_ROOT_PASSWORD=db_root_password # Change this to a secure password
      - MYSQL_DATABASE=seafile
      - SEAFILE_ADMIN_EMAIL=me@example.com
      - SEAFILE_ADMIN_PASSWORD=a_very_strong_password
    volumes:
      - /mnt/container-storage/seafile/db_data:/var/lib/mysql

  memcached:
    image: memcached:1.5.22

  seafile:
    image: corpusops/seafileltd-seafile-mc:latest
    environment:
      - DB_HOST=db
      - DB_ROOT_PASSWD=db_root_password # Change this to the same password as above
    depends_on:
      - db
      - memcached
    volumes:
      - /mnt/container-storage/seafile/seafile_data:/shared
    ports:
      - "8000:80"
      - "8082:8082"

volumes:
  db_data:
    external: true
  seafile_data:
    external: true

To start, find “MYSQLROOTPASSWORD=dbrootpassword” in the compose file, and change “dbrootpassword” to a secure, memorable database password. Then, find “DBROOTPASSWD=dbrootpassword” under the “environment” section of “seafile” in the compose file, and use the same password.

After setting the DB root password, you need to locate “SEAFILEADMINEMAIL=me@example.com” and change it to reflect the email address you wish to use with your SeaFile deployment.

Once you’ve changed the email address, you need to set the SeaFile admin password. Find “SEAFILEADMINPASSWORD=averystrong_password” and change it to a secure, memorable password for your Admin account.

When you’ve made all appropriate edits to the Docker compose file, press the Ctrl + O keyboard combination to save the text editor. Then, close it with Ctrl + X.

How to deploy SeaFile in Docker on Linux

To deploy SeaFile in Docker on your Linux server, start by opening up a terminal. With the terminal open, gain root access with either su or sudo -s. From there, use the docker compose up -d command to deploy your SeaFile compose file.

docker compose up -d

Follow along with Docker as your SeaFile setup is deployed. If everything goes well, it will be up and running in your configured containers. However, if the deployment fails, you’ll need to ensure that you’ve configured the Docker compose file correctly.

What to do next?

The SeaFile user interface showing a user uploading files.

After SeaFile is deployed, access it at the following URL in a browser:

http://ubuntu-server-hostname-or-ip/

You can then log in with your specified email and password.

Clients

SeaFile has clients for Linux, Mac OS, Windows Server, and mobile. If you’d like to get going with one of these, consider checking out the official SeaFile apps available on the website.