title: Docker permissions development environment using a host mounted volume
body: <p>I'm using docker-compose to set up a portable development environment for a bunch of symfony2 applications (though nothing I want to do is specific to symfony). I've decided to have the source files on the local machine exposed as a data volume with all the other dependencies in docker. This way developers can edit on the local file-system.</p>
  
  <p>Everything works great, except that after running the app my cache and log files and the files created by composer in the /vendor directory are now owned by root.</p>
  
  <p>I've read about this problem and some possible approaches here:</p>
  
  <p><a href="https://stackoverflow.com/questions/27784814/changing-permissions-of-added-file-to-a-docker-volume">Changing permissions of added file to a Docker volume</a></p>
  
  <p>But I can't quite quite tease out what changes I have to make in my  docker-compose.yml file  so that when my symphony container starts with <em>docker-compose up</em> any files that are created have the permissions of the user on the host machine.  </p>
  
  <p>I'm posting the file for reference, worker is where php, etc. live:</p>
  
  <pre><code>source:
      image: symfony/worker-dev
      volumes:
      - $PWD:/var/www/app
  mongodb:
      image: mongo:2.4
      ports:
      - "27017:27017"
      volumes_from:
      - source
  worker:
      image: symfony/worker-dev
      ports:
      - "80:80"
      - mongodb
      volumes_from:
      - source
      volumes:
      - "tmp/:/var/log/nginx"
  </code></pre>