Dockerised seafile installation. Expects nginx & memcached contaniers already to exist.
2.8K
Seafile is a "next-generation open source cloud storage with advanced features on file syncing, privacy protection and teamwork".
This Dockerfile does not really package Seafile for Docker, but provides an environment for running it including startup scripts + all dependencies for using MySQL and memcached.
Note this version provides only with MySQL-backed installation (not SQLite). Both db and memcache instances are expected to be created before seafile is set up. Also note this installation of seafile is expected to be ran behind a reverse proxy over https. An example of nginx config that could be used is included.
Assumes accessible mysql/maria db is already installed.
Log in to the docker/machine hosting the database and create the user & databases: (from https://github.com/foxel/seafile-docker/blob/master/scripts/setup.sh)
mysql -uroot -p${DB_ROOT_PW} <<'EOF'
DROP DATABASE IF EXISTS `ccnet_db`;
DROP DATABASE IF EXISTS `seafile_db`;
DROP DATABASE IF EXISTS `seahub_db`;
CREATE DATABASE `ccnet_db` CHARACTER SET = 'utf8';
CREATE DATABASE `seafile_db` CHARACTER SET = 'utf8';
CREATE DATABASE `seahub_db` CHARACTER SET = 'utf8';
DROP USER IF EXISTS 'seafile'@'%';
CREATE USER IF NOT EXISTS 'seafile'@'%' IDENTIFIED BY 'seafile_passwd';
GRANT ALL PRIVILEGES ON `ccnet_db`.* TO `seafile`@'%';
GRANT ALL PRIVILEGES ON `seafile_db`.* TO `seafile`@'%';
GRANT ALL PRIVILEGES ON `seahub_db`.* TO `seafile`@'%';
FLUSH PRIVILEGES;
EOF
Note you need to link seafile docker to the mariadb/mysql docker by --linking it.
The embedded setup-seafile script is executed when running the image for the
first time, which installs & sets up seafile under /seafile.
Reading through the setup manual
before setting up Seafile is still recommended, since there are more configuration
options that can be used and could be considered.
If you're using this docker on unraid, this means running the docker run command
below from command line, not from template.
Run the image in a container, exposing ports as needed and making /seafile volume permanent:
VER: actual seafile server ver (eg 6.0.7), or latestSERVER_IP: domain or IP of the box where seafile is set up; without the protocolIf you want to enable document preview/edit via
OnlyOffice,
then also define env var ONLY_OFFICE_DOMAIN, eg
ONLY_OFFICE_DOMAIN=https://onlyoffice.yourdomain.com
For example, you could use following command to install & setup (note the db data must match the one you used when creating the db tables & users)
docker run -it --rm \
-e VER=6.0.7 \
-e SERVER_NAME=seafile-server \
-e SERVER_IP=seafile.yourdomain.com \
-e FILESERVER_PORT=8082 \
-e SEAHUB_ADMIN_USER=youradminuser \
-e SEAHUB_ADMIN_PW=yourpassword \
-e USE_EXISTING_DB=1 \
-e MYSQL_HOST=db \
-e MYSQL_PORT=3306 \
-e MYSQL_USER=seafile \
-e MYSQL_USER_PASSWD=seafile_passwd \
-e CCNET_DB=ccnet_db \
-e SEAFILE_DB=seafile_db \
-e SEAHUB_DB=seahub_db \
[-e AUTOSTART=false \]
-v /path/on/host/to-installation-dir:/seafile \
--link memcached \
--link db \
layr/seafile --skip-runit -- setup-seafile
Note the memcached instance is linked to your seafile container by adding
--link memcached_container:memcached to your docker run statement.
(or use user defined networks
instead, as --link option is now deprecated)
Running following will simply download the required version and unpack it under
/seafile; you'll still want to follow upgrade notes afterwards (see below);
note VER value constraints/expectations as described above.
docker run -it --rm \
-e VER=6.0.7 \
[-e AUTOSTART=false \]
-v /path/on/host/to-installation-dir:/seafile \
layr/seafile --skip-runit -- download-seafile
Run the image again, this time you probably want to give it a name for using some
startup scripts.
The image will autostart the seafile and seahub processes if the environment
variable AUTOSTART=true is set. A reasonable docker command would be
docker run -d \
--name seafile \
-p 10001:10001 \
-p 12001:12001 \
-p 8000:8000 \
-p 8080:8080 \
-p 8082:8082 \
-v /path/on/host/to-installation-dir:/seafile \
-e AUTOSTART=true \
--link memcached \
--link db \
layr/seafile
For unraid users: this is the command that should to be converted into a Docker template.
The Seafile binaries are stored in the permanent volume /seafile. To update the
base system, just stop and drop the container, update the image using
docker pull layr/seafile and run it again. To update Seafile, follow the normal
upgrade process described in the Seafile upgrade manual
and/or seafile gitbook
and/or community docs
General steps:
AUTOSTART=false, OR execute with
command --skip-runit--skip-runit!)download-seafile script as shown above, eg (while in container shell):
AUTOSTART=true againSee here
Content type
Image
Digest
sha256:1724e9799…
Size
243.6 MB
Last updated
6 months ago
docker pull layr/seafile