{"action":"created","issue":{"url":"https://api.github.com/repos/docker/docker/issues/15828","labels_url":"https://api.github.com/repos/docker/docker/issues/15828/labels{/name}","comments_url":"https://api.github.com/repos/docker/docker/issues/15828/comments","events_url":"https://api.github.com/repos/docker/docker/issues/15828/events","html_url":"https://github.com/docker/docker/issues/15828","id":103077767,"number":15828,"title":"[QUESTION] Docker data-only container file permissions","user":{"login":"oleynikd","id":3976868,"avatar_url":"https://avatars.githubusercontent.com/u/3976868?v=3","gravatar_id":"","url":"https://api.github.com/users/oleynikd","html_url":"https://github.com/oleynikd","followers_url":"https://api.github.com/users/oleynikd/followers","following_url":"https://api.github.com/users/oleynikd/following{/other_user}","gists_url":"https://api.github.com/users/oleynikd/gists{/gist_id}","starred_url":"https://api.github.com/users/oleynikd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oleynikd/subscriptions","organizations_url":"https://api.github.com/users/oleynikd/orgs","repos_url":"https://api.github.com/users/oleynikd/repos","events_url":"https://api.github.com/users/oleynikd/events{/privacy}","received_events_url":"https://api.github.com/users/oleynikd/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-08-25T17:33:56Z","updated_at":"2015-08-25T18:12:46Z","closed_at":null,"body":"I've asked this questions on stackoverflows, #docker irc chat and couple of forums but still no solution. Please help!\r\n\r\nI'm developing PHP app and I'm stuck with Docker volumes. I've tried to create a separate data-only container for my PHP app but couldn't make it work because of permission issues... I've googled and read all I could and the most close to working solution [is described here][1]\r\n\r\nBut it's a bit old and I couldn't make it work too.\r\n\r\nI've created a repo with a simple test code:\r\nhttps://github.com/oleynikd/docker-volumes-permissions/\r\n\r\nThis simple project uses docker-compose to run 2 containers:\r\n\r\n 1. For php fpm\r\n 2. For nginx\r\n\r\nThe php code is mapped to php container and lives in `/src` directory.\r\n\r\nThe main problem is that PHP has no rights to write to code's directory because it runs as **www-data** user but code's directory belongs to user with id **1000** and group **staff**.\r\n\r\nAfter running docker-compose up and visiting /index.php you'll see the warning and `ls -lah` output that shows the permission issue. Here's the screenshot:[![enter image description here][2]][2]\r\n\r\nI've tried to fix this by adding `RUN mkdir -p /src && chown -R www-data:www-data /src` to php Dockerfile but that didn't helped.\r\n\r\nSo questions are:\r\n\r\n1. **Why the owner and the group of /src is 1000:staff?**\r\n2. **How to fix this?**\r\n\r\nI'm sure the solution is simple but I can't find it.\r\nPlease help!\r\n\r\nP.S. Feel free to contribute to repo if you know how to fix this issue.\r\n\r\n\r\n  [1]: http://stackoverflow.com/a/27021154/983914\r\n  [2]: http://i.stack.imgur.com/cPCrZ.png"},"comment":{"url":"https://api.github.com/repos/docker/docker/issues/comments/134690469","html_url":"https://github.com/docker/docker/issues/15828#issuecomment-134690469","issue_url":"https://api.github.com/repos/docker/docker/issues/15828","id":134690469,"user":{"login":"monitorjbl","id":1149136,"avatar_url":"https://avatars.githubusercontent.com/u/1149136?v=3","gravatar_id":"","url":"https://api.github.com/users/monitorjbl","html_url":"https://github.com/monitorjbl","followers_url":"https://api.github.com/users/monitorjbl/followers","following_url":"https://api.github.com/users/monitorjbl/following{/other_user}","gists_url":"https://api.github.com/users/monitorjbl/gists{/gist_id}","starred_url":"https://api.github.com/users/monitorjbl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/monitorjbl/subscriptions","organizations_url":"https://api.github.com/users/monitorjbl/orgs","repos_url":"https://api.github.com/users/monitorjbl/repos","events_url":"https://api.github.com/users/monitorjbl/events{/privacy}","received_events_url":"https://api.github.com/users/monitorjbl/received_events","type":"User","site_admin":false},"created_at":"2015-08-25T18:12:46Z","updated_at":"2015-08-25T18:12:46Z","body":"The container doesn't have a record of the users/groups your files refer to. You'll see the same phenomenon anytime you mount volumes into the container. To get around this, you could set up users/groups inside the container with matching UID/GIDs to the files outside the container. "}}