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
Hint: If you haven’t installed
composer locally, you can perform the last step from within the container too!
2. Modify the docker-compose.yaml to match your needs
3. Run the project
Check if all container where started as expected:
The result should look similar to this:
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
Clear the cache:
Navigate to the site using your favourite browser:
Attention: Please keep in mind, that the port (8080) might be a different one, if you changed it in the
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:
2. Add/change the
storage-driver attribute and set it to
Do not forget to apply the changes, this will restart the Docker Daemon and you are good to go.