Example using Docker for your local development environment with Laravel or Lumen
Branch: master
Clone or download
Latest commit c4dc43d Aug 4, 2016
Type Name Latest commit message Commit time
Failed to load latest commit information.
app dockerized :) Aug 4, 2016
bootstrap dockerized :) Aug 4, 2016
config dockerized :) Aug 4, 2016
database dockerized :) Aug 4, 2016
deploy dockerized :) Aug 4, 2016
public dockerized :) Aug 4, 2016
resources dockerized :) Aug 4, 2016
storage dockerized :) Aug 4, 2016
tests dockerized :) Aug 4, 2016
.env.example dockerized :) Aug 4, 2016
.gitattributes dockerized :) Aug 4, 2016
.gitignore dockerized :) Aug 4, 2016
artisan dockerized :) Aug 4, 2016
composer.lock dockerized :) Aug 4, 2016
docker-compose.yml dockerized :) Aug 4, 2016
gulpfile.js dockerized :) Aug 4, 2016
phpunit.xml dockerized :) Aug 4, 2016
readme.md dockerized :) Aug 4, 2016


Laravel Development with Docker

I wrote a post about using Docker for your local Laravel environment. This repo holds a clean Laravel install setup to use Docker which can be used as a starting point or for reference.

The following is used out of the box with this setup:

  • PHP 7 FPM
  • Nginx web server
  • Mysql database
  • Redis for cache


You'll want to copy the .env.example file to .env like usual. Run composer install to install dependencies and that should be it for the app.

Once you install Docker, you can start the containers using Docker Compose

$ docker-compose up -d

You should be able to visit the app at http://localhost:8080 You should also be able to run artisan commands from your local machine :)

To stop the containers you can run $ docker-compose kill. If you'd like to remove them all together, after stopping run $ docker-compose rm.


Here's an overview of the setup. This repo contains the default Laravel 5.2 install other than the files listed below. If you'd like a more in depth explanation of the files below, see the blog post I mentioned above.

/deploy I've added the deploy directory because I like to keep all of the configuration files together (Dockerfiles, service config, etc). I named it deploy because ideally you would be using the files in here to build images that get deployed (Docker containers). You can obviously change that as you see fit.

docker-compose.yml This file lets us tell Docker how to build our environment. When we call docker-compose up it will read this file and build the necessary containers as well as configure things like networking and volumes.

deploy/app.docker This is the Dockerfile for our app container. It just extends the PHP base image provided by Docker and installs some extra extensions that Laravel needs (mcrypt and mysql).

deploy/web.docker This is the Dockerfile for our web container. It extends the Nginx base image provided by Docker, and just adds an Nginx config file so our web service knows how to handle requests.

deploy/vhost.conf This is the Nginx config file thats added to our web container. It's a pretty standard host configuration that proxy's PHP requests to our app container. You'll notice that it communicates with the app container via address app:9000. The app name is what we named our service and linked to in docker-compose.yml, so Docker will know we mean that container and route the request appropriately.