This post requires basic knowledge of Docker, Docker-Compose and Symfony 3!

A few months ago i published an example project that contains a Symfony 3 standard edition and a simple Docker Compose environment.

I decided to update this project to the latest Symfony LTS version of the v3-branch (3.4).

While doing so, I also made some major changes to the docker setup including a switch from Apache to Nginx and separating the webserver and the PHP process (like it is recommended).

The new setup is pretty straight forward:

1. Clone the example project, cleanup and install vendors

git clone my-project
cd my-project
rm -rf .git
composer install --ignore-platform-reqs --no-interaction --no-scripts

Hint: If you haven’t installed php and/or composer locally, you can perform the last step from within the container too!

2. Modify the docker-compose.yaml to match your needs

cp docker-compose.yaml.dist docker-compose.yaml
nano docker-compose.yaml

3. Run the project

docker-compose up -d

Check if all container where started as expected:

docker ps -a

The result should look similar to this:

Docker Processlist

4. Log into the PHP container

Attention: Please keep in mind, that the name of the container (sf3tpl_php) might be a different one, if you changed it in the docker-compose.yaml-file!

docker exec -it sf3tpl_php /bin/bash

Copy the parameters.yml.dist-file:

cp app/config/parameters.yml.dist app/config/parameters.yml

Clear the cache:

./bin/console cache:clear --env=prod

Navigate to the site using your favourite browser:


Symfony 3 Docker Welcomepage

Attention: Please keep in mind, that the port (8080) might be a different one, if you changed it in the docker-compose.yaml-file!

Bonus: Mac mount perforamnce

To increase the volume performance on macOS, you might want to modify the default filesystem behavior.

In my optinion the overlay2 storage driver works best in most cases and increases the performance dramatically.

For further informations on this topic (including alternatives and more details), please refer to the official documentation.

1. Navigate to the Docker preferences pane in the top menue:

Docker preferences

2. Add/change the storage-driver attribute and set it to overlay2:

  "debug" : true,
  "storage-driver" : "overlay2",
  "experimental" : true

Docker storage driver

Do not forget to apply the changes, this will restart the Docker Daemon and you are good to go.