seafile-admin-docs/manual/setup/seafile_docker_autostart.md
Huang Junxiang e5716cba11
Some checks are pending
Deploy CI - 13.0 / deploy (push) Waiting to run
13.0 republish (#479)
* Add changelog for 12.0.10

* Add changelog for 12.0.10

* fix: migrate from non-docker

* fix: minimal install for mariadb in backup and recover

* fix: fuse content missing in host

* opt:adjusting migration strategy

* Add changelog for pro 12.0.10

* Update security_features.md

Update descriptions for encrypted library.

* Update seahub_settings_py.md

Update description for encrypted library versions.

* docs: update Windows development setup instructions for vcpkg (#471)

* Update drive-client-changelog.md

3.0.13

* update seasearch.yml

* update

* Update shibboleth_authentication.md

* Update remote_user.md

* fix: backup & restore command mysql -> mariadb

* update backup and recovery commands and tip

* opt: steps in recovering DB

* update link of note of MDEV-30203 note from Mariadb

* update link of note of MDEV-30203 note from Mariadb

* opt: steps in recovering DB

* Add changelog for 12.0.11-pro

* Add changelog for v12.0.11

* republish 13.0

* fix: ce binary deployment format error

---------

Co-authored-by: Daniel Pan <daniel.pan@seafile.com>
Co-authored-by: Daniel Pan <freeplant@gmail.com>
Co-authored-by: Jiaqiang Xu <jonathan.xu@seafile.com>
Co-authored-by: rumtid <liwei.jiang@seafile.com>
Co-authored-by: r350178982 <32759763+r350178982@users.noreply.github.com>
Co-authored-by: lian <imwhatiam123@gmail.com>
2025-03-19 19:49:57 +08:00

1.8 KiB

Seafile Docker autostart

You can use one of the following methods to start Seafile container on system bootup.

Modify docker-compose.service

  1. Add docker-compose.service

    vim /etc/systemd/system/docker-compose.service

    [Unit]
    Description=Docker Compose Application Service
    Requires=docker.service
    After=docker.service
    
    [Service]
    Type=forking
    RemainAfterExit=yes
    WorkingDirectory=/opt/   
    ExecStart=/usr/bin/docker compose up -d
    ExecStop=/usr/bin/docker compose down
    TimeoutStartSec=0
    
    [Install]
    WantedBy=multi-user.target
    

    !!! note WorkingDirectory is the absolute path to the seafile-server.yml file directory.

  2. Set the docker-compose.service file to 644 permissions

    chmod 644 /etc/systemd/system/docker-compose.service
    
  3. Load autostart configuration

    systemctl daemon-reload
    systemctl enable docker-compose.service
    

Modify Docker files

Add configuration restart: unless-stopped for each container in components of Seafile docker. Take seafile-server.yml for example

services:
  db:
    image: mariadb:10.11
    container_name: seafile-mysql-1
    restart: unless-stopped

  redis:
    image: redis
    container_name: seafile-redis
    restart: unless-stopped

  elasticsearch:
    image: elasticsearch:8.6.2
    container_name: seafile-elasticsearch
    restart: unless-stopped

  seafile:
    image: seafileltd/seafile-pro-mc:12.0-latest
    container_name: seafile
    restart: unless-stopped

!!! tip Add restart: unless-stopped, and the Seafile container will automatically start when Docker starts. If the Seafile container does not exist (execute docker compose down), the container will not start automatically.