I have several tasks encapsulated in Docker containers which I need to trigger on a regular basis. The scheduling can be done with systemd. Both tools together have proven to be a quite powerful combination.
Example: Backup service
Let's assume we have a backup service that lives in /opt/backup. This folder contains a docker-compose.yaml file which contains the configuration of a backup service.
We need one systemd unit for the service and one for the timer. Both are shown below. The setup is pretty straight forward.
The service unit has a OnFailure hook which runs a separate systemd service in case the exit code of the service is non-zero. This idea comes from the Arch Wiki. The status email service can be configured in a generic way such that it can be re-used in other systemd services as well.
Finally the timer needs to be started/enabled as usual: