Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permission Denied on fresh docker build #1866

Closed
ethanpailes opened this issue Mar 2, 2016 · 4 comments
Closed

Permission Denied on fresh docker build #1866

ethanpailes opened this issue Mar 2, 2016 · 4 comments

Comments

@ethanpailes
Copy link

When trying to use docker with stack I get the following error every time I run stack build:

~/.stack/config.yaml: openBinaryFile: permission denied (Permission denied)

I am running Fedora 23. There might be something wrong with the way that I have docker configured, though I can run the hello-world docker image just fine.

Steps to Reproduce

 > stack new foo simple
 > cd foo

 # change stack.yaml to include
 docker:
     enable: true


 > stack build

Expected

That the project would build.

Actual

A permission denied error.

output of stack build --verbose

Version 1.0.4, Git revision cf18703b1392a96a5a4896a560309e501af63260 (3220 commits) x86_64
2016-03-01 22:55:27.348924: [debug] Checking for project config at: /home/ethan/Downloads/foo/stack.yaml @(stack_COhPD0SUWBs7s1VUFLBNcf:Stack.Config src/Stack/Config.hs:761:9)
2016-03-01 22:55:27.349374: [debug] Loading project config file stack.yaml @(stack_COhPD0SUWBs7s1VUFLBNcf:Stack.Config src/Stack/Config.hs:779:13)
2016-03-01 22:55:27.351818: [debug] Run process: docker --version @(stack_COhPD0SUWBs7s1VUFLBNcf:System.Process.Read src/System/Process/Read.hs:269:3)
2016-03-01 22:55:27.395325: [debug] Run process: docker inspect fpco/stack-build:lts-5.5 @(stack_COhPD0SUWBs7s1VUFLBNcf:System.Process.Read src/System/Process/Read.hs:269:3)
2016-03-01 22:55:27.643109: [debug] Run process: docker create --net=host -e STACK_IN_CONTAINER=1 -e STACK_ROOT=/home/ethan/.stack -e STACK_PLATFORM_VARIANT=dkda49f7ca9b244180d3cfb1987cbc9743 -e HOME=/home/ethan/Downloads/foo/.stack-work/docker/_home -e PATH=/opt/host/bin:/home/ethan/Downloads/foo/.stack-work/docker/_home/.local/bin:/opt/host/bin:/opt/stackage/lts-5/extra/bin:/opt/stackage/lts-5/ghc/bin:/opt/stackage/lts-5/tools/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin -e PWD=/home/ethan/Downloads/foo -v /home/ethan/.stack:/home/ethan/.stack -v /home/ethan/Downloads/foo:/home/ethan/Downloads/foo -v /home/ethan/Downloads/foo/.stack-work/docker/_home:/home/ethan/Downloads/foo/.stack-work/docker/_home -w /home/ethan/Downloads/foo -e USER=ethan -v /home/ethan/.ssh:/home/ethan/Downloads/foo/.stack-work/docker/_home/.ssh -e SSH_AUTH_SOCK=/run/user/1000/keyring/ssh -v /run/user/1000/keyring/ssh:/run/user/1000/keyring/ssh -v /usr/bin/stack:/opt/host/bin/stack -t -i fpco/stack-build:lts-5.5 /opt/host/bin/stack --internal-re-exec-version=1.0.4 --internal-docker-entrypoint "DockerEntrypoint {deUser = Just (DockerUser {duUid = 1000, duGid = 1000, duGroups = [10,1000,1001], duUmask = 18})}" build --verbose @(stack_COhPD0SUWBs7s1VUFLBNcf:System.Process.Read src/System/Process/Read.hs:269:3)
2016-03-01 22:55:29.572852: [debug] Run process: /usr/bin/docker start -a -i 36338582c1a8990c1d8524f057fbe23f97092776a7f91e4b6dd7fd1142be8c20 @(stack_COhPD0SUWBs7s1VUFLBNcf:System.Process.Run src/System/Process/Run.hs:105:5)
Version 1.0.4, Git revision cf18703b1392a96a5a4896a560309e501af63260 (3220 commits) x86_64
/home/ethan/.stack/config.yaml: openBinaryFile: permission denied (Permission denied)
2016-03-01 22:55:30.604846: [debug] Run process: docker rm -f 36338582c1a8990c1d8524f057fbe23f97092776a7f91e4b6dd7fd1142be8c20 @(stack_COhPD0SUWBs7s1VUFLBNcf:System.Process.Read src/System/Process/Read.hs:269:3)

Output of stack --version

Version 1.0.4, Git revision cf18703b1392a96a5a4896a560309e501af63260 (3220 commits) x86_64

Output of docker --version

Docker version 1.9.1-fc23, build 110aed2-dirty

Output of sudo service docker status

Redirecting to /bin/systemctl status  docker.service
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: active (running) since Tue 2016-03-01 18:34:35 EST; 4h 39min ago
     Docs: http://docs.docker.com
 Main PID: 4117 (docker)
   CGroup: /system.slice/docker.service
           ├─ 373 docker-applyLayer /var/lib/docker/devicemapper/mnt/58d60c5b5595ebea8b2fb8116c860b262...
           └─4117 /usr/bin/docker daemon --selinux-enabled --log-driver=journald

Mar 01 22:55:27 slabtop docker[4117]: time="2016-03-01T22:55:27.426494101-05:00" level=error msg="...=404
Mar 01 22:55:27 slabtop docker[4117]: time="2016-03-01T22:55:27.675996734-05:00" level=info msg="{...31}"
Mar 01 22:55:29 slabtop docker[4117]: time="2016-03-01T22:55:29.621433748-05:00" level=info msg="{...81}"
Mar 01 22:55:29 slabtop docker[4117]: time="2016-03-01T22:55:29.622826968-05:00" level=info msg="{...in=t
Mar 01 22:55:29 slabtop docker[4117]: 2016/03/01 22:55:29 http: multiple response.WriteHeader calls
Mar 01 22:55:29 slabtop docker[4117]: [91B blob data]
Mar 01 22:55:29 slabtop docker[4117]: time="2016-03-01T22:55:29.801763551-05:00" level=info msg="{...81}"
Mar 01 22:55:29 slabtop docker[4117]: [86B blob data]
Mar 01 22:55:30 slabtop docker[4117]: time="2016-03-01T22:55:30.639860424-05:00" level=info msg="{...37}"
Mar 01 23:11:38 slabtop docker[4117]: time="2016-03-01T23:11:38.886893239-05:00" level=info msg="{...54}"
Hint: Some lines were ellipsized, use -l to show in full.

Some Things I Have Tried

  1. setting permissions on ~/.stack/config.yaml to the most permissive
  2. running stack as root
  3. fiddling with the resolver version (I tried both 5.5 and 3.20)
@silky
Copy link
Contributor

silky commented Mar 2, 2016

fwiw i can't reproduce this with stack 1.0.5:

> stack --version
Version 1.0.5, Git revision e7b331f14bcffb8367cd58fbfc8b40ec7642100a x86_64

> docker --version
Docker version 1.9.1, build a34a1d5
> cat stack.yaml
resolver: lts-5.5
docker:
    enable: true
packages:
- '.'
extra-deps: []
flags: {}
extra-package-dbs: []

@mgsloan
Copy link
Contributor

mgsloan commented Mar 2, 2016

Hmm, who owns ~/.stack/config.yaml? If it was initialized by a run with sudo, then you'll get this result, though usually only with versions of stack before #471 was fixed.

If it's not that, perhaps you need to give non-root access to docker? http://askubuntu.com/questions/477551/how-can-i-use-docker-without-sudo

@ethanpailes
Copy link
Author

I own everything in ~/.stack, and I have already set up a docker group and added it to the list of auxiliary groups for myself.

I feel like this could be an issue with how I have docker configured, but I can't figure out what it might be.

@ethanpailes
Copy link
Author

For unrelated reasons I reinstalled by operating system and that seems to have fixed things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants