Source: engineering.carsguide.com.au

How to Dockerize a Laravel application

Category: Laravel, PHP, api

When I first was told to use Docker in my local dev environment. All I can remember is that I need to bring a container up docker-compose up and then bring it down by docker-compose down.

When we use docker commands, the client sends them to docker daemon (dockerd) to execute them.

Step Create a docker-compose.yaml file in the root directory of your project with the following code touch docker-compose.yamlStep Create a Dockerfile in the root directory of your project with the following code touch DockerfileStep Create a laravel.ini file with the following code touch laravel.iniStep Create a folder to store the nginx Dockerfile and add a Dockerfile inside it with the following code mkdir docker-nginx && cd docker-nginx && touch DockerfileStep Create a entrypoint.sh file inside docker-nginx directory with the following code touch entrypoint.shStep Create a fpm-template.conf file inside docker-nginx with the following code touch fpm-template.confStep Create a nginx.conf file inside docker-nginx directory with the following code touch nginx.confStep Go back to the root directory and create a .env file from the existing .env.example file and modify the following fields in your .env file to use the values specified in the database container cd ... && cp .env.example .env

I am excited that I have shared my knowledge on how to use Docker to develop Laravel Applications.
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners