{"action":"created","issue":{"url":"https://api.github.com/repos/docker/docker/issues/15785","labels_url":"https://api.github.com/repos/docker/docker/issues/15785/labels{/name}","comments_url":"https://api.github.com/repos/docker/docker/issues/15785/comments","events_url":"https://api.github.com/repos/docker/docker/issues/15785/events","html_url":"https://github.com/docker/docker/issues/15785","id":102729079,"number":15785,"title":"Permissions problem on Docker 1.8 when reading from stdin","user":{"login":"riklaunim","id":1822699,"avatar_url":"https://avatars.githubusercontent.com/u/1822699?v=3","gravatar_id":"","url":"https://api.github.com/users/riklaunim","html_url":"https://github.com/riklaunim","followers_url":"https://api.github.com/users/riklaunim/followers","following_url":"https://api.github.com/users/riklaunim/following{/other_user}","gists_url":"https://api.github.com/users/riklaunim/gists{/gist_id}","starred_url":"https://api.github.com/users/riklaunim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/riklaunim/subscriptions","organizations_url":"https://api.github.com/users/riklaunim/orgs","repos_url":"https://api.github.com/users/riklaunim/repos","events_url":"https://api.github.com/users/riklaunim/events{/privacy}","received_events_url":"https://api.github.com/users/riklaunim/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":23,"created_at":"2015-08-24T07:46:04Z","updated_at":"2015-10-03T13:54:41Z","closed_at":null,"body":"In my build scripts I have a line like so:\r\n\r\n        tar c --mtime=2014-01-01 --exclude=__pycache__ --exclude=Dockerfile.template --mode=\"g=u,o=rX\" --owner=root --group=root . | docker build --tag=$IMAGE_NAME:$BUILD_NUMBER -\r\n\r\nIt does work on Docker < 1.8 but on 1.8 it now throws:\r\n\r\n    unable to prepare context: unable to extract stdin to temporary context direcotry: lchown /tmp/docker-build-context-183505935/run_entrypoints.sh: operation not permitted\r\n\r\nI can change it to use sudo:\r\n\r\n            tar c --mtime=2014-01-01 --exclude=__pycache__ --exclude=*.pyc --exclude=Dockerfile.template --mode=\"g=u,o=rX\" . | sudo docker build --tag=$IMAGE_NAME:$BUILD_NUMBER -\r\n\r\nand then it works, but I wonder if it's a bug or some change that affects permissions/users."},"comment":{"url":"https://api.github.com/repos/docker/docker/issues/comments/145250445","html_url":"https://github.com/docker/docker/issues/15785#issuecomment-145250445","issue_url":"https://api.github.com/repos/docker/docker/issues/15785","id":145250445,"user":{"login":"tomwys","id":255939,"avatar_url":"https://avatars.githubusercontent.com/u/255939?v=3","gravatar_id":"","url":"https://api.github.com/users/tomwys","html_url":"https://github.com/tomwys","followers_url":"https://api.github.com/users/tomwys/followers","following_url":"https://api.github.com/users/tomwys/following{/other_user}","gists_url":"https://api.github.com/users/tomwys/gists{/gist_id}","starred_url":"https://api.github.com/users/tomwys/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tomwys/subscriptions","organizations_url":"https://api.github.com/users/tomwys/orgs","repos_url":"https://api.github.com/users/tomwys/repos","events_url":"https://api.github.com/users/tomwys/events{/privacy}","received_events_url":"https://api.github.com/users/tomwys/received_events","type":"User","site_admin":false},"created_at":"2015-10-03T13:54:41Z","updated_at":"2015-10-03T13:54:41Z","body":"This is bug, not documentation issue. `docker` client is user-space program and shouldn’t require root permissions to run. Feature of passing tar archive to `docker build` has been broken since 1.7, because it requires root access to be run in cases described above (no other feature of `docker` client requires root access).\r\n\r\n`/tmp/` directory is not the problem and creating custom `/tmp/` dir will not solve this case. The problem is that `docker` client tries to extract archive preserving file ownership. This fails because non-root user can't change files ownership to arbitrary users.\r\n\r\nThe solution would be to:\r\n* do not extract archive at all (for example you can work with archive in memory or extract only part of files),\r\n* extract archive without file ownership  preservation, and handle file ownership by other means."}}