grobles16 / laravel-docker
A laravel and docker extension for easy installation
Installs: 42
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Language:Dockerfile
This package is auto-updated.
Last update: 2025-06-23 01:13:43 UTC
README
Install
After creating your laravel project you need to do some configuration first and have docker-compose installed
- Install package
composer require grobles16/laravel-docker
- To detect the routes file it is necessary to add the following code in config / app.php
'providers' => [ Grobles16\LaravelDocker\LaravelDockerProvider::class, ],
- Publish files in our root folder
php artisan vendor:publish --provider="Grobles16\LaravelDocker\LaravelDockerProvider" --tag=laravel-docker --force
Docker settings
- Edit the .env file assign the name of the DB, user, password
DB_CONNECTION=mysql DB_HOST=mysql DB_PORT=3306 DB_DATABASE=laravel DB_USERNAME=laravel DB_PASSWORD=laravel
- Once the changes have been made in the .env file, execute the following command, this will allow us to create our containers:
docker-compose build app
- Turn on the containers and the network:
docker-compose up -d
- To display information about the status of active services, run:
docker-compose ps
- After executing step 3 our containers are already up, but we still need to run a couple of commands to finish configuring our application. You can use the docker-compose exec command to run commands on service containers, such as ls -l to display detailed information about the files in our application directory:
docker-compose exec app ls -l
- If necessary, run the following command to assign permissions to our project
docker-compose exec app chown -R www-data: /var/www
- Now we run "composer install" to install the app dependencies:
docker-compose exec app rm -rf vendor composer.lock docker-compose exec app composer install
- Generate a unique app key
docker-compose exec app php artisan key:generate
- Go to the browser and put the following
localhost:8000
Optional information
- If you want to pause your Docker Compose environment while maintaining the state of all your services, run:
docker-compose pause
- Resume services
docker-compose unpause
- To shut down the Docker environment
docker-compose down