Dockerfile for creating image with cron deamon on alpine linux
140
Dockerfile for creating image with cron deamon on alpine linux. This image enables the end user to add additional packages on container start.
docker run \
-d \
--name crond \
-e 'ADD_PACKAGES=<additional packages>' \
-e 'CRON_STRINGS=* * * * * root /scripts/my-script.sh' \
-v /path/to/custom/scripts:/scripts \
-v /path/to/custom/crontab:/etc/cron.d \
maschel/crond
ADD_PACKAGES (optional): space seperated list of (APK) packages to install before the container is started (mind the '').CRON_STRINGS (optional): list of cronjobs to be added to crond. use \n for newline. (mind the '')./scripts Location for storing custom scripts which can be run via cronjobs./etc/cron.d Add multiple cron files.version: "3"
services:
crond:
container_name: crond
image: maschel/crond
restart: unless-stopped
environment:
- 'ADD-PACKAGES="<additional packages>'
- 'CRON-STRINGS='* * * * * root /scripts/my-script.sh'
volumes:
- /path/to/custom/scripts:/scripts
- /path/to/custom/crontab:/etc/cron.d
MIT LICENSE - Copyright (c) 2018 Geoffrey Mastenbroek
Content type
Image
Digest
Size
2 MB
Last updated
over 8 years ago
docker pull maschel/crond