Skip to content

vtslshah/Laravel-Dockerized-App

Repository files navigation

Dockerized Laravel Application

This repository demonstrates how to set up a Laravel application using Docker, complete with Nginx, MySQL, and PHPMyAdmin.

Prerequisites

  • 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.

Getting Started

Clone the Repository

git clone https://github.com/vatsal-ajmera/Laravel-Dockerized-App.git cd Laravel-Dockerized-App

Set Up Environment Variables

Copy the example .env file and configure it as needed:

cp .env.example .env

Start the Docker Containers

Start the containers in detached mode:

docker-compose up -d

Install Dependencies

Install Laravel dependencies using Composer:

docker exec -it app composer install

Run Database Migrations

Run the migrations to set up your database schema:

docker exec -it app php artisan migrate

Useful Commands

Accessing the Laravel Application Container

Enter the application container shell to run Artisan commands:

docker-compose exec app sh

Accessing the MySQL Container

Enter the MySQL container shell to run MySQL queries:

docker exec -it mysql-container bash

Once inside the MySQL shell, connect to the database using:

mysql -u root -p

Stopping and Restarting Containers

Stop and remove all containers:

docker-compose down

Rebuild and start the containers:

docker-compose up -d

Viewing Logs

View logs for a specific container (e.g., MySQL):

docker logs mysql-container

Additional Reference

For more detailed guidance, refer to the following article: Dockerizing a Laravel App


Happy coding!

About

Basic laravel Set up with docker

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages