title: Symfony and Docker - Cache and Log dirs permissions
body: <p>I am trying to setup a Symfony project using docker but it always return errors related to permissions in "cache" directory.</p>
  
  <p>I have tried everything and I can't seem to find a solution.
  The problem is somehow the cache folder is always created with "root" owner even with my server and php-fpm user set as www-data. Maybe because of the php-cli user?</p>
  
  <p>I have tried:
  - setfacl : Don't work with docker
  - chown / chmod to www-data: also didn't work. it might changes the owner correctly in the begining but them gives an error in other place.</p>
  
  <p><strong>docker-compose.yml</strong></p>
  
  <pre><code>app:
    build: .
    command: "tail -f /dev/null" # keep the application container running
    links:
        - mysql
    volumes:
      - .:/var/www
  
  nginx:
    build: docker/nginx/
    ports:
      - 8090:80
    links:
      - php-fpm
    volumes_from:
      - app
  
  php-fpm:
    build: docker/fpm
    ports:
      - 9000:9000
    volumes_from:
      - app
  
  mysql:
    image: mysql:5.7
    volumes:
       - ./docker/data/mysql:/var/lib/mysql
  </code></pre>
  
  <p><strong>My app Dockerfile:</strong></p>
  
  <pre><code>FROM php:5.6-cli
  
  ENV DEBIAN_FRONTEND noninteractive
  
  RUN apt-get update &amp;&amp; apt-get install -y \
      git \
      vim \
      curl \
      php5-json \
      php5-intl \
      php5-mcrypt \
      php5-mysql \
      php5-apcu \
      php5-gd
  
  ADD /docker/fpm/php.ini /usr/local/etc/php/
  
  # install composer.
  RUN curl -sS https://getcomposer.org/installer | php
  RUN mv composer.phar /usr/local/bin/composer
  
  RUN usermod -u 1000 www-data
  
  ADD . /var/www
  
  WORKDIR /var/www
  </code></pre>
  
  <p><strong>PHP-fpm Dockerfile</strong></p>
  
  <pre><code>FROM php:5.6-fpm
  
  ENV DEBIAN_FRONTEND noninteractive
  
  RUN apt-get update &amp;&amp; apt-get install -y \
      php5-json \
      php5-intl \
      php5-mcrypt \
      php5-mysql \
      php5-apcu \
      php5-gd
  
  RUN apt-get install -y php5-xdebug
  ADD xdebug.ini /usr/local/etc/php/conf.d/
  ADD php.ini /usr/local/etc/php/
  
  EXPOSE 9000
  
  WORKDIR /var/www   
  CMD ["php-fpm"]
  </code></pre>
  
  <p><strong>Nginx Dockerfile</strong></p>
  
  <pre><code>FROM nginx:latest
  
  
  ENV DEBIAN_FRONTEND noninteractive
  
  RUN apt-get update &amp;&amp; apt-get install -y git vim
  ADD nginx.conf /etc/nginx/
  ADD symfony.conf /etc/nginx/sites-available/
  
  RUN mkdir -p /etc/nginx/sites-enabled
  RUN ln -s /etc/nginx/sites-available/symfony.conf /etc/nginx/sites-enabled/
  
  RUN usermod -u 1000 www-data
  
  EXPOSE 80
  EXPOSE 443
  
  ENTRYPOINT ["nginx"]
  </code></pre>
  
  <p>I am out of ideas. Any suggestions?
  Thank you.</p>