Bookmark

Run Seafile in Docker

Seafile is an open-source file synchronization and sharing platform. This guide runs MariaDB and Seafile on one Docker network and stores their data under ~/docker/mariadb and ~/docker/seafile.

Youtube video player

Install Docker

Log into Linux with sudo access and run:

1
2
3
4
5
6
7
sudo apt install apt-transport-https ca-certificates curl software-properties-common gnupg-agent -y
curl -fsSL https://download.docker.com/linux/$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release)/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release) $(lsb_release -cs) stable"
sudo apt install docker-ce docker-compose containerd.io -y
sudo systemctl enable docker && sudo systemctl start docker
sudo usermod -aG docker $USER
su - $USER

For a current distribution, also see the Docker documentation because apt-key is deprecated.

Run MariaDB and Seafile

  1. Create the directories and network:
1
2
3
mkdir ~/docker/mariadb -p && mkdir ~/docker/seafile
sudo chown "$USER":"$USER" ~/docker -R
docker network create containers
  1. Start MariaDB. Replace [DB_ROOT_PASSWORD] with a private secret:
1
2
3
4
docker run -d --name mariadb --network containers \
  -e MYSQL_ROOT_PASSWORD='[DB_ROOT_PASSWORD]' \
  -v ~/docker/mariadb:/var/lib/mysql \
  --restart=unless-stopped mariadb:latest
  1. Start Seafile and point it to the mariadb container:
1
2
3
4
5
6
docker run -d --name seafile --network containers -p 8080:80 \
  -e DB_HOST=mariadb \
  -e DB_ROOT_PASSWD='[DB_ROOT_PASSWORD]' \
  -e TIME_ZONE=Asia/Ho_Chi_Minh \
  -v ~/docker/seafile:/shared \
  --restart=unless-stopped seafileltd/seafile-mc:11.0-latest

Configure Seafile

  1. Open http://DNSorIP:8080 and wait for first initialization.
  2. Sign in with the administrator account created by the image or your configured credentials; do not use the source's sample credentials.
  3. Click the profile icon > System Admin > Users.
  4. Click Add User, enter a private email and password, then Submit.
  5. Open Admin, click Add Admin, select the new user, and Submit.
  6. Log out, sign in as the new user, and return to System Admin > Users.
  7. Select the sample [email protected] user if it exists and click Delete Users.
  8. Test upload, download, library creation, and sharing permissions.

Warning: Back up both ~/docker/seafile and the database before upgrading the image. Do not expose MariaDB to the Internet; place Seafile behind an HTTPS reverse proxy outside the LAN.

Sources and video


0 Bình luận

Góp Ý / Bình Luận / Đánh giá