jordanorc / docker-cron

A very simple Docker container for executing cron jobs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

docker-cron

This is a simple Docker container which executes cron jobs.

If you need help writing the cron entry, checkout crontab.guru.

Using the image

This image really isn't as useful on its own, but is better used as a base for job-specific iamges.

For very simple cron jobs simply specify the CRONTAB_ENTRY environment variable. This is plugged directly into root's crontab spool.

docker run \
    --name some-cron \
    -e CRONTAB_ENTRY="* * * * * touch /some_file"
    dkruger/cron

More likely you'll need to modify the docker image to add additional utilities and/or tweak the crontab entry based on other environment variables. To help with that there is a entrypoint hook directory /entrypoint.d which you can place your own entrypoint files into. They will be sourced by the main ENTRYPOINT before the crontab is written. For an example, checkout dkruger/mysql-backup.

About

A very simple Docker container for executing cron jobs


Languages

Language:Shell 51.9%Language:Dockerfile 48.1%