Setting up environment for Laravel, Symfony and WP using only one docker

masoud sharifi
Jul 14 · 3 min read

This is the easiest way to dockerize Symfony, Laravel and WP together with one docker environment using Laradock.

Laradock is a full PHP development environment for Docker. It includes pre-packaged Docker Images, all pre-configured to provide a wonderful PHP development environment.

Install requirements

GIT

Docker >= 17.12

Step 1: Fork Laradock repo

Fork Laradock repo from main Laradock repository:

After Fork this repo you have copy of Laradock in your github account.

Step 2: Clone Laradock to local machine

Clone forked Laradock repository to your local machine whit following commands:

Create branch from stable version of Laradock and switch to that branch:

Step 3: Configure Laradock

Make .env file from env-example:

Note: Laradock using the last version of MySQL (version 8). I used MySQL 5.7 in my project because i couldn’t setup laravel with version 8. To change version of MYSQL edit .env and find MYSQL_VERSION=latest and change it to MYSQL_VERSION=5.7

Set WORKSPACE_INSTALL_SYMFONY to true in .env file to install Symfony Local Web Server:

Step 4: Make projects directory

Create 3 directory in Laradock parent directory so you should create symfony, laravel and wordpress. List directory structure

After ls you folder structure should look like this:

Step 5: Configure NGINX

Go to laradock nginx folder and copy default.conf for all projects:

Edit symfony.conf , laravel.conf and wordpress.conf and set server_name and change root path for each of theme.For example for wordpress edit wordpress.conf like this:

Edit laravel.conf like this:

And for symfony:

Step 6: Create projects domain

Edit hosts file:

And add the following lines to hosts:

Step 7:Builds, creates, starts services

Run following commands in laradock directory to builds, creates and starts docker services:

After run all project you can check if all docker services is run with docker-compose ps.

Step 8: Install symfony

Go to laradock folder and go to enter workspace container:

Install symfony framework:

Enter symfony.test in your browser.

Step 9: Instll laravel

Go to laradock folder and go to enter workspace container:

Install laravel framework:

Move laravel folder content to parent directory:

Enter laravel.test in your browser.

Step 10: Install wordpress

Exit workspace and go to wordpress folder:

Get wordpress file and extract it:

Move wordpress directory content to parent directory.

Enter wordpress.test in browser.

Feel free to contact me if you have any questions on Twitter

masoud sharifi

Written by

Backend Developer

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade