Run cron jobs inside a container
- dcron
- curl
- wget
- rsync
- ca-certificates
CRON_STRINGS
- string with cron jobs. Use "\n" for newline (Default: undefined)
CRON_TAIL
- if defined, cron log file will read to stdout
by tail
(Default: undefined)
By default cron is running in foreground
/etc/cron.d
- place to mount custom crontab files
At runtime, files in /etc/cron.d
will copied to /var/spool/cron/crontab
.
If present, CRON_STRINGS
will create /var/spool/cron/crontab/CRON_STRINGS
.
docker run -d \
-v /path/to/app/conf/crontabs:/etc/cron.d \
-v /path/to/app/scripts:/scripts \
instantbox/cron
docker run -d \
-e 'CRON_STRINGS=* * * * * root /scripts/myapp-script.sh'
-v /path/to/app/scripts:/scripts \
instantbox/cron
docker run -d \
-e 'CRON_STRINGS=* * * * * root wget https://example.com/job'
instantbox/cron
Log file by default placed in /var/log/cron/cron.log