< go back to home

Quick Laravel Setup Using Docker

April 11, 2020

This is a quick way to setup Laravel using Docker. This is useful for use cases like experimentation or tutorials where you just want to have a running Laravel immediately. I am new at Docker so expect that this would change as I learn more optimum practices.

It is heavily based from this tutorial. If you want more explanations and descriptions, refer to that tutorial. The focus of this writeup is just to present the barebone actual step-by-step to start using Laravel with Docker.

Requirements

Step 1

Fetch the codebase in Github.

Step 2

Install dependencies using Composer.

Step 3

Setup .env files from .env.example. Two .env files are needed, one is in the root folder, and the other is in the "src" folder. This is a temporary setup as I'm still figuring out an issue in just having one ".env" file. So assuming that .env.example files have the correct values already:

Step 4

Run the docker build command.

Step 5

Start the docker container.

Step 6

After "step 5" Laravel homepage should be available in http://localhost:8001.



Step 7

Run artisan commands.