# Running Laravel inside Docker containers

This guide will walk you through setting up a Laravel application to run inside docker containers. We will cover everything from setting up nginx, php, mysql and redis on your local environment and how to get it deployed to production.

# Requirements

Before getting started, there's a few requirements that you need to have installed

The advantage of using Docker is that you don't have to install or maintain any software on your local machine. Additionally, by using containers there will be no disparity between local development, staging and production.

NOTE

In this article we will assume that you are running Docker for Mac for local development.

# Topics covered

  • How to run your Laravel application locally using docker-compose
  • How to run composer install using Docker
  • How to compile assets with Docker and Laravel Mix
  • How to deploy the application to your production server using docker swarm

Sample scripts used in this guide can be found on GitHub at https://github.com/Daursu/laradocker

A full working Laravel 8 example application can be found at https://github.com/Daursu/docker-compose-laravel8