Delayed restarts #
A delayed restart via Docker Swarm’s restart_policy
provides a native way to implement periodic tasks.
Setup #
Add the following service to your stack:
|
|
In this example, the service will start every 30 minutes and run the mc
command to backup the files.
For brevity, we omit the configuration of the mc
client, but see the official documentation for help.
Tips #
When multiple jobs are deployed, execution (via the delay
) may need to be spread out:
- each job requires certain resources to start and run
- executing many of jobs in parallel can impact other services