Run the scheduler in a docker image?

Posted 2 years ago by jimmy.puckett

We are trying to decide the best way to run the scheduler in a docker container. Given that the php /path/to/artisan schedule:run >> /dev/null 2>&1 command runs & then exits, you cannot let it be the CMD for the Docker file unless you launch a new container for each minute to run the scheduler. We have 3 options that are considering...

  1. Have a shell script for the CMD that is in a loop that calls php /path/to/artisan schedule:run >> /dev/null 2>&1 & then sleeps for the balance of a minute

  2. Add a new artisan command like schedule:loop that does what #1 above does but in php. Then use the artisan command as the CMD for the docker file

  3. Have the docker scheduler launch a new container every minute with an image that has the php /path/to/artisan schedule:run >> /dev/null 2>&1 as the CMD

For any of you that are running laravel in docker, how are you solving this issue?

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.