Add alias command to a Laravel Sail container
Create file and folder in Laravel called “aliases/.bash_aliases” at the top level (eg same as app folder)
Insert required aliases for php artisan as per your preference in the .bash_aliases file
eg
alias pa="php artisan"
alias pat="php artisan tinker"
alias pamfs="php artisan migrate:fresh --seed"
Then in the Docker compose file, in the laravel section add the following line in the volumes section.
volumes:
- '.:/var/www/html'
- './aliases/.bash_aliases:/root/.bash_aliases'
Then build the sail containers.
Open the terminal in docker destop and type “bash” to get bash terminal, then all alias commands will work!