crontool
Paste a schedule, read it in English, see the next runs.

Cron Inside a Docker Container

A container runs one process, and base images don't start a cron daemon. To schedule jobs inside Docker you install cron, add your crontab, and run cron in the foreground so the container stays up.

Minimal Dockerfile

FROM debian:stable-slim
RUN apt-get update && apt-get install -y cron
COPY my-cron /etc/cron.d/my-cron
RUN chmod 0644 /etc/cron.d/my-cron && crontab /etc/cron.d/my-cron
CMD ["cron", "-f"]

cron -f runs the daemon in the foreground so the container doesn't exit.

Env vars are the catch

Cron won't see the container's environment. Export the vars into a file at startup and source them in the job, or bake them into the crontab, or use an entrypoint that writes printenv > /etc/environment before starting cron.

Better: schedule outside the container

For one-shot tasks prefer the host's cron running docker run --rm yourimage yourjob, or Kubernetes CronJob. That avoids running a scheduler inside every container.

FAQ

Why doesn't cron run in my Docker container?

Base images don't start a cron daemon, and a container only runs its main process. Install cron and run it in the foreground with cron -f as the container command.

How do I keep a cron container running?

Use CMD ["cron", "-f"] so the daemon runs in the foreground; otherwise the container starts cron, sees the process exit, and stops.

Why can't my Dockerized cron job see environment variables?

Cron uses a minimal environment. Write the container's env to a file at startup (printenv > /etc/environment) or source an env file inside the job.