was successfully added to your cart.


I has been asked how to make Laravel run in Docker, and more importantly how to deploy it to a production server, since then I have been exploring for options and Laradocks seems to be a simplified way to go for.

So before digging into Laradock, will be doing a vanilla dockerization to get the concept clear first.

1.  Get docker installed in your development machine: Google docker -> find your platform Mac / PC -> install it

2. Create your Laravel Project and put it to a Git repo: Google Laravel Quick Start -> Google Gitlab, to host your repo if you don’t have any

3. Create a file with name ‘Dockerfile’ at the root of your Laravel project with this content:

FROM creativitykills/nginx-php-server:2.0.0
COPY . /var/www/
RUN chmod -Rf 777 /var/www/storage/

4. Build the Docker image and run it:

# Run this in your terminal
cd /path/to/your/laravel_project_root

# Build the image with tag laravel01
docker build . -t laravel01

# Run the docker container, bind port 80 of container to localhost8000
docker run -d -p 8000:80 --name="laravel-dev" laravel01

5. Start developing your Laravel and debugging it

6. Realize that changes made in code won’t reflect in localhost:8000 after refresh

7. We will solve this in part 2, by using docker mount volume


About howmun

Leave a Reply