Run Symfony 4 with Docker

If you want to run your next Symfony 4 project within Docker the guys of medium have a great instruction for you.

However I had to additionally install the php zip extension (for docker). You can do this by adding the command

docker-php-ext-install zip

in

.docker/php/Dockerfile

My first RUN command in .docker/php/DOCKERFILE looks as the following:

RUN apt-get update \ apt-get install -y --no-install-recommends vim curl debconf subversion git apt-transport-https apt-utils \ build-essential locales acl mailutils wget zip unzip libz-dev \ gnupg gnupg1 gnupg2 \ && docker-php-ext-install zip

Without the additional command the package for facebook/webdriver would have thrown a dependency error

If you have performance issues running your application locally on docker, you can follow the blog post of DracoBlue for more insights.

tldr;
You get a better performance if you add the „:cached“ flag to your mounted php volume:

php:
  build: .docker/php
  container_name: php_container
  volumes:
    - .:/home/wwwroot/app:cached
  depends_on:
    - mysql

 

Mai 5th, 2019