Answer the question
In order to leave comments, you need to log in
Why is crontab not working in docker Laravel?
There is a job in crontab:
* * * * * php /var/www/site.ru/artisan schedule:run >>/dev/null 2>&1
php /var/www/site.ru/artisan schedule:run >>/dev/null 2>&1
Answer the question
In order to leave comments, you need to log in
it worked with the command on the server itself * * * * * docker exec app_swiftcloud sh -c 'php /var/www/site.ru/artisan schedule:run >>/dev/null 2>&1'
Because docker is not a virtual machine, but a homogeneous group of processes. There is simply no cron running and no need to want to do it.
Crones and other schedulers must be outside the fpm container.
Roughly speaking, for the simplest case, run docker run --rm imagename php /var/www/site.ru/artisan schedule:run on the host
Most likely because the php command is not found in the docker container.
Try to do whereis php and write the full path to the interpreter, something like /usr/local/bin/php
Alternatively, log errors and cron runs separately by adding the crontab file at the top
exec 1>/var/log/cronlog.log
exec 2>/var/log/cronlog.err
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question