🚀 Quickly set up your Laravel application with Docker!
This starter template simplifies the process of building a Laravel application using Docker, allowing you to get up and running without needing to install PHP locally.
- Pre-configured Laravel 11 application
- Easy configuration through a customizable
docker.env
file. - Pre-defined scripts for building and connecting to your Docker containers.
- Seamless integration with phpMyAdmin for database management.
-
Start by creating a new repository based on the Laravel Docker Template on GitHub.
-
Clone the new repository on your computer and open it in your favourite editor or IDE to get started.
-
Open the file
docker.env
and customize any of the environment variables to your needs. You may change theDC_*
values in order to avoid container conflicts with already running containers.# Container name for the app service in docker-compose.yaml, must be unique for all containers running on your docker instance DC_APP_NAME=Laravel11 # Forwarded port for the Laravel app service DC_APP_PORT=8880 # Forwarded port for phpMyAdmin service to view the underlying application database DC_PMA_PORT=8881 # MySQL credentials - username MYSQL_USER=app_development # MySQL credentials - password MYSQL_PASSWORD=password # MySQL credentials - database MYSQL_DATABASE=app_db
-
Once you have successfully configured your app via the
docker.env
file, run the./dkbuild.sh
file to build your container images and run the application. -
Next, run
./dkconnect.sh
to connect to theapp
service container where the Laravel application is running. -
Run
composer install
to install the application and it's dependencies.
Congratulations on getting to this point. When you run ./dcconnect.sh
you will be shown the two URLs that you may use
to access the application and the database (via phpMyAdmin).
Inside the container, you may run any php
or artisan
command as you build your application. Any
changes you make in this container are immediately visible in your IDE and vice versa.
Happy coding! 🎉