Hint: Office preview in 9.x with docker - how to keep it running after reboot

I noticed that after reboot the “seafile-office-preview” container did not restart, so preview did not work. The instruction in the manual is missing this part (while for elasticsearch-container the “–restart=always” is included in the manual).
So you should update the seafile container as well with “sudo docker update --restart always seafile-office-preview”
Would be good to update the manual accordingly.
Ubuntu experts probably all know this, but as a novice I needed a while to find this out.

I tried the --restart=always command and it didn’t work, so I created a systemd service.

sudo nano /lib/systemd/system/seafile-office-preview.service

paste the following into the service file

[Unit]
Description=Seafile Office Preview
Requires=docker.service
After=docker.service

[Service]
Type=oneshot
RemainAfterExit=yes
WorkingDirectory=/opt/seafile/office-preview
ExecStart=/usr/local/bin/docker-compose up -d
ExecStop=/usr/local/bin/docker-compose down
TimeoutStartSec=0
Restart=on-failure
RestartSec=5s

[Install]
WantedBy=multi-user.target

ctrl +x then y to save, then run the following command

sudo systemctl enable seafile-office-preview.service