Running CLI Commands
Normally, you can run CLI commands on a container using the docker compose exec:
# Install dependenciesdocker compose exec app composer install
# Run artisan commandsdocker compose exec app php artisan migrate
# Open a shell for debuggingdocker compose exec app bashHowever, if the server fails to start (e.g., due to a missing vendor directory or PHP error), you can run Composer or Artisan commands directly:
# Install dependenciesdocker compose run --rm app composer install
# Run artisan commandsdocker compose run --rm app php artisan migrate
# Open a shell for debuggingdocker compose run --rm app bashThese commands spin up a temporary container, execute the command, and exit—bypassing the FrankenPHP server entirely which might be useful when using the container in worker mode.