Install and Set Up Laravel with Docker Compose
Setting up Laravel in the local environment with Docker using the LEMP stack that includes: Nginx, MySQL, PHP.
Why use Docker for Development
- 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
How to Install and Run the Project
git clone https://github.com/Shibly/laravel-10-docker-boilerplate-.git
cd src
composer install
- Copy
.env.example
to.env
docker-compose build
docker compose up -d
- You can see the project on
http://localhost
How to use MySQL as a database
- Uncomment the MySQL configuration inside the
docker-compose.yml
including:db
andphpMyAdmin
- Copy
.env.example
to.env
- Change
DB_CONNECTION
tomysql
- Change
DB_HOST
todb
- Change
DB_PORT
to3306
- Open the
phpMyAdmin
onhttp://localhost:3400/
How to run Laravel Commands with Docker Compose
cd src
docker-compose exec app php artisan {your command}