A lightweight Docker setup for running Drupal cron jobs via HTTP requests.
This project provides a containerized cron service that makes HTTP requests to trigger Drupal cron jobs. It's designed to work alongside a Drupal installation running in Docker containers.
- caddy: Web server serving Drupal
- php-fpm: PHP-FPM service for Drupal
- cron: Alpine-based container that periodically calls Drupal's cron endpoint
Configure the cron service via environment variables:
environment:
CRON_SCHEDULE: "*/1 * * * *" # Run every minute (cron format)
OPTIONS: "-s drupal/cron/__drupal-cron-hash__" # Curl options and URL
Start all services:
docker-compose up -d
Run cron immediately:
docker-compose exec cron /start.sh now
View cron logs:
docker-compose logs -f cron
- Update
OPTIONS
environment variable with your Drupal cron URL - Adjust
CRON_SCHEDULE
as needed - Start the services with
docker-compose up -d
The cron service will automatically begin making requests to your Drupal installation based on the configured schedule.