Laravel installed with Docker in just 5 minutes

Subscribe to my newsletter and never miss my upcoming articles

In this guide I will teach you to setup your Laravel project for a dev environment. After you finish with this article you will have Laravel running in Docker, without the need to understand Docker as I have prebuild it for you.


Before you are moving on with the guide, you should have installed Docker. The setup works indifferently on MacOS and Windows and should also work on Linux. You can download Docker here:

###Setup environment

Make a new project as per according to Laravel documentation:

composer new MyProject

Download my script to your project folder (feel free to open the URL and investigate it):

curl --output vm

On MacOS and Linux you might have to make the file executable:

chmod +x vm

####Configure Laravel settings

Before you build your project, you must change a few things in your .env. If you change this after you build the environment, the setup won't work.

Open .env in Sublime Text or any other text editor and change these variables:

# Set App name, the Docker container will use this name

# Database should be configured to the Docker environment. Database name is optionally but I like to name it after my project

####Build environment

You are now ready to build your environment:

./vm build

Press Y to begin the process.

After it's done, you can browse to http://localhost to verify that Laravel works.

###Using the script

Your Docker instance is already up and running, to stop it again simply run

./vm stop

And to start it

./vm start

There are a few more commands such as composer and npm but that would executive them inside the container where they should generally be run outside on your host machine.

To get a list of available commands use:


You can also read this post on my blog at

No Comments Yet