Setting up Laravel in the local environment with Docker using the LEMP stack that includes: Nginx, MySQL, PHP, and phpMyAdmin.
- Consistent development environment for the entire team.
- You don't need to install a bunch of language environments on your system.
- You can use different versions of the same programming language.
- Deployment is easy
git clone git@github.com:hanieas/Docker-Laravel.gitdocker-compose exec app composer install- Copy
.env.exampleto.env docker-compose builddocker compose up -d- You can see the project on
127.0.0.1:8080
- Uncomment the MySQL configuration inside the
docker-compose.ymlincluding:dbandphpMyAdmin - Copy
.env.exampleto.env - Change
DB_CONNECTIONtomysql - Change
DB_PORTto3306 - Open the
phpMyAdminon127.0.0.1:3400
- Uncomment the PostgreSQL configuration inside the
docker-compose.ymlincluding:dbandpgamdin - Copy
.env.exampleto.env - Change
DB_CONNECTIONtopgsql - Change
DB_PORTto5432 - Open the
pgAdminon127.0.0.1:5050
cd srcdocker-compose exec app php artisan {your command}
https://medium.com/@hanieasemi/setting-up-a-laravel-local-environment-with-docker-7541ae170daf