betterweb/cron
Dead simple crontab container - https://github.com/BetterCorp/docker-cron
32
Dead simple crontab container for running scheduled commands in Docker.
version: '3.9'
services:
cron:
image: betterweb/cron:latest
command: "curl https://example.com/cron.txt"
environment:
- CRON_SCHEDULE="*/5 * * * *" # Run every 5 minutes
- CRON_APTS="curl"
- CRON_IMMEDIATE="false"
Docker run:
sudo docker run -e "CRON_SCHEDULE=* * * * *" -e "CRON_APTS=curl" -e "CRON_IMMEDIATE=false" betterweb/cron:latest "curl https://example.com/cron.txt"
CRON_SCHEDULE
: Cron schedule expression (required)CRON_APTS
: Space-separated list of additional packages to install (optional)The CRON_SCHEDULE must contain all 5 components:
┌───────────── minute (0 - 59)
│ ┌───────────── hour (0 - 23)
│ │ ┌───────────── day of month (1 - 31)
│ │ │ ┌───────────── month (1 - 12)
│ │ │ │ ┌───────────── day of week (0 - 6) (Sunday to Saturday)
│ │ │ │ │
* * * * *
Common Examples:
* * * * *
*/5 * * * *
0 * * * *
0 0 * * *
0 3 * * 1
Special Characters:
*
: any value*/n
: every n intervalsn-m
: range from n to mn,m
: specific values n and mContributions are welcome! Please feel free to submit a Pull Request.
MIT
docker pull betterweb/cron