title: Docker PHP permissions
body: <p>My php container does not have the permissions to write cache on the mounted volume.</p>
  
  <p>docker-compose.yml:</p>
  
  <pre><code>version: '2'
  volumes:
      database_data:
          driver: local
  services:
      php:
          build: ./docker/php/
          expose:
              - 9000
          volumes:
              - ./public:/var/www/html
          working_dir: /var/www/html
      nginx:
          image: nginx:latest
          depends_on:
              - php
          ports:
              - 80:80
          volumes:
              - ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf
          volumes_from:
              - php
  </code></pre>
  
  <p>docker/php/Dockerfile:</p>
  
  <pre><code>FROM php:7.0-fpm
  
  RUN docker-php-ext-install pdo_mysql \
      &amp;&amp; docker-php-ext-install json
  
  
  # Permission fix
  RUN usermod -u 1000 www-data
  </code></pre>