I'm trying to run the following command after the container is up and running.
php artisan queue:work -n -q &
The "&" is there because the daemon option was deprecated and later removed from Laravel.
However, this breaks my container startup completely.
CMD ["php", "artisan", "queue:work", "-n", "-q", "&"]
How should I do this in a Docker way?
EDIT:
Using docker-compose I added this line to my docker-compose.yml file
command: bash -c 'php artisan queue:work -n -q;'
The container started but did not serve any requests :S
Using this:
command: bash -c 'php artisan queue:work -n -q &; echo "runs"; tail -f /dev/null'
The container stopped after starting up
Final solution
So in the end I thought that maybe the server in charge of delivering the app should not be the one running the queue.
Therefore I spin up another instance of the same docker image with the sole purpose of running artisan queue:work.