mirror of
https://github.com/docker/awesome-compose.git
synced 2025-04-26 10:43:35 +02:00
|
||
---|---|---|
.. | ||
nginx/conf.d | ||
php | ||
src | ||
docker-compose.yml | ||
README.md |
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, and phpMyAdmin.
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 git@github.com:hanieas/Docker-Laravel.git
cd src
composer install
- Copy
.env.example
to.env
docker-compose build
docker compose up -d
- You can see the project on
127.0.0.1:8080
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_PORT
to3306
- Open the
phpMyAdmin
on127.0.0.1:3400
How to use PostgreSQL as a database
- Uncomment the PostgreSQL configuration inside the
docker-compose.yml
including:db
andpgamdin
- Copy
.env.example
to.env
- Change
DB_CONNECTION
topgsql
- Change
DB_PORT
to5432
- Open the
pgAdmin
on127.0.0.1:5050
How to run Laravel Commands with Docker Compose
cd src
docker-compose exec app php artisan {your command}
Medium
https://medium.com/@hanieasemi/setting-up-a-laravel-local-environment-with-docker-7541ae170daf