- razonyang/php-cron:7.4(latest)
- razonyang/php-cron:7.3
- razonyang/php-cron:7.2
$ docker run --name php-cron razonyang/php-cron:latest
Verify:
$ docker exec php-cron tail -f /tmp/cron.log
2019-08-09 06:28:01
2019-08-09 06:29:01
2019-08-09 06:30:01
2019-08-09 06:31:01
2019-08-09 06:32:01
Custom configuration
$ docker run --name php-cron \
-v /your/crontab:/etc/crontab:ro razonyang/php-cron:latest \
/bin/bash -c "/usr/bin/crontab /etc/crontab && /usr/sbin/cron -f"
We MUST apply the new crontab
before starting cron
service.
docker-compose.yml
services:
cron:
image: razonyang/php-cron:latest
restart: always
volumes:
- ./crontab:/etc/crontab:ro
command: bash -c "/usr/bin/crontab /etc/crontab && /usr/sbin/cron -f"