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

Docker permission error #6285

Closed
1 task done
Ismael opened this issue Oct 14, 2016 · 3 comments
Closed
1 task done

Docker permission error #6285

Ismael opened this issue Oct 14, 2016 · 3 comments

Comments

@Ismael
Copy link

Ismael commented Oct 14, 2016

  • I'm submitting a ...
  • Bug report

I'm using the official grafana/grafana image.
I'm using Vagrant with CoreOS as docker host. I have /var/lib/grafana mounted from the host, which is mounted through NFS.

My NFS server has this in /etc/exports
"/srv/vagrant/coreos-vagrant/shared" 172.17.8.101(rw,no_subtree_check,all_squash,anonuid=1000,anongid=1000,fsid=893788748)

In my docker host I'm running:
docker run -i -p 3000:3000 -v /srv/grafana:/var/lib/grafana/ grafana/grafana

And docker logs grafana shows this:
chown: changing ownership of '/var/lib/grafana': Operation not permitted

Grafana is not running, the container keeps failing.

@torkelo
Copy link
Member

torkelo commented Oct 15, 2016

/var/lib/grafana needs to be accessible/writable by user running grafana-server, by default the user uses grafana

@torkelo torkelo closed this as completed Oct 15, 2016
@Ismael
Copy link
Author

Ismael commented Oct 17, 2016

But the user won't exist outside the container...

I solved this by changing the userid and groupid of grafana to 1000, which is the usual user/group id for a single user. See discussion at moby/moby#7198 (comment)

This is my Dockerfile

FROM grafana/grafana

RUN groupmod -g 1000 grafana \
    && usermod -u 1000 grafana \
    #&& `find / -user 104 -exec chown -h 1000 {} \;` \
    #&& `find / -group 107 -exec chgrp -h 1000 {} \;` \
    && usermod -g 1000 grafana \
    && chown -R grafana:grafana /var/lib/grafana

@ornith-it-admin
Copy link

The problem is worse if you have read-only snapshots on your NFS share, since even with the above permission fix, grafana insists on owning files that are read-only, and the container fails.

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