Dedicated WordPress cron runner extending "jamesmorrison/php"
7.4K
Dedicated WordPress cron runner extending jamesmorrison/php. Runs due WordPress cron events through WP-CLI on a repeating interval, independently of web requests.
Image: jamesmorrison/php-wp-cron
PHP versions: 8.2, 8.3, 8.4 and 8.5.
Platforms: linux/amd64 and linux/arm64.
Version tags follow the format jamesmorrison/php-wp-cron:<version>. Test tags use <version>-test-<commit-sha>.
Each version builds on the matching jamesmorrison/php:<version> image.
| Setting | Default |
|---|---|
| Base operating system | Ubuntu 24.04, inherited from the PHP image |
| PHP version for local builds | 8.5 |
| Container user | www-data - UID/GID 33 |
| Working directory | /var/www/html |
| Default startup script | /entrypoint.sh |
| Default process | Repeating WP-CLI cron loop |
| Delay between runs | 60 seconds |
PHP-FPM is installed in the base image but is not started by this image. The cron runner does not provide an HTTP or FastCGI service.
The runner executes wp cron event run --due-now immediately after startup validation, then sleeps before the next run.
Only events that are due are executed. Events run sequentially within each invocation; the delay begins after the command finishes, so the interval between starts includes execution time.
WP-CLI output and timestamped success or warning messages are written to the container logs.
If a cron invocation fails, the runner logs a warning and continues with the next iteration. Invalid startup paths or missing WordPress files cause the container to exit.
| Variable | Default | Purpose |
|---|---|---|
WP_ROOT_DIR | /var/www/html | WordPress installation directory |
WP_CRON_FREQUENCY | 60 | Sleep duration between cron invocations, in seconds |
WP_CRON_FREQUENCY must be a valid duration accepted by sleep. An invalid value causes the runner to exit.
The image does not install WordPress. It requires an existing installation with:
wp-load.php inside WP_ROOT_DIR.wp-config.php inside WP_ROOT_DIR or its parent directory.www-data, including write access where callbacks require it.The runner should use the same WordPress files, configuration and database as the web application.
When this runner is responsible for scheduling, set DISABLE_WP_CRON to true in WordPress configuration to disable request-triggered cron. This is a WordPress constant, not an environment variable interpreted by the runner.
Avoid overlapping runners for the same site unless coordination is handled separately; the entrypoint does not implement a cross-container lock.
PHP extensions, WP-CLI, Composer and other tools are inherited from the PHP image.
CLI OPcache is disabled by default. Each cron invocation starts a new PHP CLI process.
This image replaces the PHP base image's startup script. It does not perform the base script's mail, FPM session or opt-in Datadog configuration.
| Argument | Default | Purpose |
|---|---|---|
PHP_VERSION | 8.5 | Selects the matching PHP base image version |
BASE_IMAGE | jamesmorrison/php | Selects the base image repository |
PHP settings are inherited from the selected base image.
Runs wp cron event list from WP_ROOT_DIR and checks its exit status.
| Setting | Value |
|---|---|
| Interval | 30 seconds |
| Timeout | 10 seconds |
| Startup grace period | 40 seconds |
| Retries | 3 |
The check verifies that WP-CLI can load WordPress and list cron events. It does not verify that the runner is advancing or that cron callbacks have completed successfully.
Content type
Image
Digest
sha256:fd99721fc…
Size
228 MB
Last updated
4 days ago
docker pull jamesmorrison/php-wp-cron:8.2