Wallogit.com
2017 © Pedro Peláez
Docker environment for Laravel projects
*** WORK IN PROGRESS ***, (*2)
AEKAB uses this package to enable Docker dev environment for Laravel project development., (*3)
PHP Composer, (*4)
Docker Machine, (*5)
Install Laravel or go to your Laravel project root, (*6)
composer create-project laravel/laravel theproject
Step into the project folder, (*7)
cd theproject
Install this package with composer and require-dev, (*8)
composer require ekandreas/docker-laravel:* --dev
Create a deploy file in the project root, a file called "deploy.php", eg:, (*9)
<?php
include_once 'vendor/ekandreas/docker-laravel/recipe.php';
server('theproject.dev', 'default')
->env('container', 'laravel')
->stage('development');
Note! It's really important that you have a valid .env -file in the project root because Docker-Laravel will take DB_DATABASE and settings as parameters when creating the mysql container. Set the DB_HOST to same as your Docker machine IP!, (*10)
Partitial example of a .env -file:, (*11)
... DB_HOST=192.168.99.100 DB_DATABASE=lund DB_USERNAME=root DB_PASSWORD=root ...
Run the script command in the terminal at your project root:, (*12)
vendor/bin/dep docker:up development
If you have installed PHP deployer locally then run it without the path to "dep", just:, (*13)
dep docker:up development
Note! Change your DNS so that the URL points to the docker machine! Eg for Mac:, (*14)
nano /etc/hosts
Then browse to theproject.dev and start develop your awesome web app., (*15)
Stop the containers (php+mysql), (*16)
dep docker:stop development
Note! Your web containers will be removed. If you get the wrong laravel image then do:, (*17)
dep docker:cleanup development
And the container will be killed and the image removed to provide a new next startup. Good when need to create new image for Laravel containers., (*18)
..., (*19)