title: Laravel installed on a local volume (Mac) from docker nginx/php-fpm can't write session files
body: <p>I have a docker-compose.yml file that runs the following (create image called mmm/nginx):</p>
  
  <pre><code>web:
   image: mmm/nginx
   ports:
   - "80:80"
   volumes:
   - ./var:/var/www
   - ./etc/nginx/sites-enabled:/etc/nginx/sites-enabled/
   links:
   - php
   - db
  
  php:
   image: rossriley/php56-fpm
   volumes:
   - ./var:/var/www
   - ./etc/php5/php-fpm.conf:/etc/php5/fpm/php-fpm.conf
   links:
   - db
  
  db:
   image: sameersbn/mysql
   ports:
   - "3306:3306"
   volumes:
   - /var/lib/mysql
   environment:
   - DB_NAME=tables
   - DB_USER=table
   - DB_PASS=pass
  </code></pre>
  
  <p>it serves up the websites nicely that are stored in <code>/var/www</code></p>
  
  <p>The issue happens when it tries to write to the logs and tries to write session files. While <strong>it does</strong> create the files, it can't write them.</p>
  
  <p>The folder for the <code>storage</code> and its nested directories have the permissions set to <code>777</code>.</p>
  
  <p>In order for laravel to write to them, I have to <code>$ chmod 777 &lt;.log|sessionfile&gt;</code> and it works nicely. Clearly, this is not the way to develop as I need to start new sessions regularly and create new logs daily.</p>
  
  <p>How can I give laravel and the docker containers permission to write the files they create?</p>
  
  <p><strong>Update:</strong>
  This is what laravel's log says: </p>
  
  <pre><code>local.ERROR: exception 'ErrorException' with message 'file_put_contents(/var/www/com.mtrinteractive.sandbox.form/storage/framework/sessions/e0117b8ca17af9c19572ddb305a272b4c22bd18d): failed to open stream: Permission denied' in /var/www/com.mtrinteractive.sandbox.form/vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:81
  </code></pre>
  
  <p><strong>Update #2</strong></p>
  
  <p>Here's the project directory:</p>
  
  <p><a href="https://i.stack.imgur.com/TrABt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/TrABt.png" alt="enter image description here"></a></p>
  
  <p><strong>Update #3</strong></p>
  
  <p>Here are the project's permissions and owners:</p>
  
  <p><a href="https://i.stack.imgur.com/taRtD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/taRtD.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/SSNFx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/SSNFx.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/r3GGz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/r3GGz.png" alt="enter image description here"></a></p>