Run Seafile in Docker
Nghia Phan
Table of Contents
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.
Install Docker
Log into Linux with sudo access and run:
sudo apt install apt-transport-https ca-certificates curl software-properties-common gnupg-agent -ycurl -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 -ysudo systemctl enable docker && sudo systemctl start dockersudo usermod -aG docker $USERsu - $USER
For a current distribution, also see the Docker documentation because apt-key is deprecated.
Run MariaDB and Seafile
- Create the directories and network:
mkdir ~/docker/mariadb -p && mkdir ~/docker/seafilesudo chown "$USER":"$USER" ~/docker -Rdocker network create containers
- Start MariaDB. Replace
[DB_ROOT_PASSWORD]with a private secret:
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
- Start Seafile and point it to the
mariadbcontainer:
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
- Open
http://DNSorIP:8080and wait for first initialization. - Sign in with the administrator account created by the image or your configured credentials; do not use the source’s sample credentials.
- Click the profile icon > System Admin > Users.
- Click Add User, enter a private email and password, then Submit.
- Open Admin, click Add Admin, select the new user, and Submit.
- Log out, sign in as the new user, and return to System Admin > Users.
- Select the sample
me@example.comuser if it exists and click Delete Users. - Test upload, download, library creation, and sharing permissions.
Warning: Back up both
~/docker/seafileand the database before upgrading the image. Do not expose MariaDB to the Internet; place Seafile behind an HTTPS reverse proxy outside the LAN.
Quảng cáo
Sources and video
- Original tutorial: i12bretro 0952
- Original video: Run Seafile in Docker
Comments & Discussion
Share your thoughts, ask questions and feedback