Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

6acypman's avatar

Best practice to run artisan commands with docker?

I'm moving to dockerized development and wonder what is a good way of running artisan commands? I see 2 ways which I don't really like:

  1. exec to container
  2. install php on the host and run there
0 likes
1 reply
Tray2's avatar

If you can't SSH into the server then you can create an alias for it in your bash_profile or bashrc

alias dmm='docker-compose exec app php artisan make:controller'

so

docker-compose exec app php artisan make:controller MyController

Would become

dmm MyController
1 like

Please or to participate in this conversation.