Laravel scheduler and docker cron

  cron, docker, laravel, php

I have a docker file which has some of the following

ADD ./.docker/config/cron/$BUILD_ENV.cron /etc/cron.d/cron
RUN chmod 0644 /etc/cron.d/cron
RUN touch /var/log/cron.log

and the file ends with

CMD cron && tail -f /var/log/cron.log

My cron file comprises of

* * * * * root /usr/local/bin/php /var/www/pub/artisan schedule:run >> /var/log/cron.log 2>&1

With the extra line of course.

If I create the file with the following the cron runs.

 * * * * * root echo "Hello world" >> /var/log/cron.log 2>&1

However my laravel artisan isn’t firing? Any help would be appreciated. The cron is created as root, and executed as root.

Source: Docker Questions

LEAVE A COMMENT