This repository demonstrates how to set up a Laravel application using Docker, complete with Nginx, MySQL, and PHPMyAdmin.
- Docker and Docker Compose installed on your system.
- XAMPP for managing local virtual hosts (if applicable).
- A registered virtual host, e.g.,
docker-app.local, in your XAMPP configuration folder.
git clone https://github.com/vatsal-ajmera/Laravel-Dockerized-App.git cd Laravel-Dockerized-AppCopy the example .env file and configure it as needed:
cp .env.example .envStart the containers in detached mode:
docker-compose up -dInstall Laravel dependencies using Composer:
docker exec -it app composer installRun the migrations to set up your database schema:
docker exec -it app php artisan migrateEnter the application container shell to run Artisan commands:
docker-compose exec app shEnter the MySQL container shell to run MySQL queries:
docker exec -it mysql-container bashOnce inside the MySQL shell, connect to the database using:
mysql -u root -pStop and remove all containers:
docker-compose downRebuild and start the containers:
docker-compose up -dView logs for a specific container (e.g., MySQL):
docker logs mysql-containerFor more detailed guidance, refer to the following article: Dockerizing a Laravel App
Happy coding!