Cron for Containers is a lightweight cron daemon for containers that aims to be an in-place replacement for ofelia wherever mail capabilities are not required.
Currently, only docker and podman are supported.
Install the executable with cargo:
cargo install cfc
You may either provide a configuration file or extract configuration from container labels.
The scheduling format is an "augmented" cron format inspired by go's implementation. E.g. @every 10m`` or
0 10 * * * *`.
Note: The cron format does not have to contain the seconds specifier
You can configure four different kind of jobs:
job-exec
: Executed in a running container.
job-run
: Executed in a new container, using a specific image.
job-local
: Executed on the host running ofelia.
job-service-run
: Executed in a new "run-once" service, for running inside a swarm
[job-exec "job-executed-on-running-container"]
schedule = @hourly
container = my-container
command = touch /tmp/cfc
job-executed-on-running-container:
kind: job-exec
schedule: "@hourly"
container: my-container
command: touch /tmp/cfc
docker run -it --rm \
--label cfc.job-run.my-test-job.schedule="@every 5s" \
--label cfc.job-run.my-test-job.command="echo Hello world" \
alpine:latest sleep 9999
Add --ofelia
to the command-line when running cfc to run in compatibility mode.
Though both an executable and a library are made available, the library is only intended for consumption by the executable and its API should not be considered stable.