Run action from a container.
mount your crondir into /crondir.
/crondir must have directories :
and/or 1 file custom.cron like:
# min hour day month weekday command
* * * * * my-command
* * * * * docker exec mycontainer /usr/local/bin/backupDatabase.sh
In each directory put your script for cron.
## Default config
# min hour day month weekday command
* * * * * run-parts /etc/periodic/1min
*/15 * * * * run-parts /etc/periodic/15min
0 * * * * run-parts /etc/periodic/hourly
0 2 * * * run-parts /etc/periodic/daily
0 3 * * 6 run-parts /etc/periodic/weekly
0 5 1 * * run-parts /etc/periodic/monthly
version: "3.5"
services:
cron:
image: docker-cron:latest
environment:
- TZ=Europe/Paris
volumes:
# Map containers from host
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./crondirtest:/crondir:ro
- ./crondirtest/log:/var/log/cron
Content type
Image
Digest
sha256:e6a7270d7…
Size
121 MB
Last updated
over 2 years ago
docker pull wyzenrepo/docker-cron