-
-
Notifications
You must be signed in to change notification settings - Fork 143
Adds note for using cron #393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Thank you! |
Hi @DarkGhostHunter, I’m having trouble getting this setup to work. Here’s my docker-compose.yml setup:
And my Dockerfile:
However, when running the php_cron service, I encounter the following issue in the logs:
It looks like the cron process is failing due to permission issues (seteuid: Operation not permitted). Could this be due to running as www-data? Do you have any recommendations on how to properly configure the cron service within this container setup? |
I believe the image must change the cron permissions to be able to run. Can you try adding this before the
|
yes, thank you
|
@DarkGhostHunter chmod gu+s /usr/sbin/cron
chmod gu+rw /var/run would allow www-data to run cron, and while this does enable execution, it doesn’t solve the core issue. After further troubleshooting, I found that cron is designed to run as root and requires root privileges to function properly. Instead, I used the following approach: 1️⃣ Installed cron as root in the Dockerfile. 2️⃣ Created a crontab for the www-data user:
3️⃣ Ensured the container runs as root in docker-compose.yml:
This way, cron runs with the necessary permissions, but scheduled jobs still execute as www-data, maintaining proper security and access control. |
Adds some paragraphs to the docs regarding using
cron
as an alternative when there is no other alternative.On Debian images, it must be installed manually (usually on the production step), while on Alpine images
crond
is included OOTB.Sometimes there is no possibility to add a scheduler command, like on third-party applications or else.