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

Variable user/group ID support for Docker #24536

Open
ivunchata opened this issue May 11, 2020 · 9 comments
Open

Variable user/group ID support for Docker #24536

ivunchata opened this issue May 11, 2020 · 9 comments

Comments

@ivunchata
Copy link

What would you like to be added:
The current Dockerfile has PID/GID hardcoded to 472 and therefore cannot be dynamically changed.

Why is this needed:
When deploying with docker-compose there is an extra step, namely the ownership change for the folder where Grafana's data resides.
This would simplify docker-compose setups where .env is used for the rest of the participating components.

This can be resolved easily with s6 overlay in a similar fashion to what the guys at linuxserver.io are doing. There is a further bonus when using s6-setuidgid since it drops root privileges.

I don't mind creating the PR, but I'd like to ask for the dev team's opinion first.
I could not find an open nor closed issue that addresses this, so please forgive me if I'm duplicating a previous question on the topic.

@aknuds1 aknuds1 added this to Inbox in Backend Platform Backlog via automation May 11, 2020
@marefr marefr added the needs investigation for unconfirmed bugs. use type/bug for confirmed bugs, even if they "need" more investigating label Jun 11, 2020
@marefr marefr moved this from Inbox to Investigations in Backend Platform Backlog Jun 11, 2020
@aknuds1 aknuds1 added this to To do in Backend Platform Squad via automation Oct 6, 2020
@aknuds1 aknuds1 removed this from Investigations in Backend Platform Backlog Oct 6, 2020
@aknuds1
Copy link
Contributor

aknuds1 commented Nov 2, 2020

It isn't exactly true that Dockerfile hardcodes PID/GID, since it takes arguments to control them (i.e., GF_UID and GF_GID).

Are you saying you need to change PID/GID after the Docker image has been built? I'm not familiar with that use case. Can you not solve this by configuring PID/GID when building your image?

@aknuds1 aknuds1 added needs more info Issue needs more information, like query results, dashboard or panel json, grafana version etc and removed needs investigation for unconfirmed bugs. use type/bug for confirmed bugs, even if they "need" more investigating labels Nov 2, 2020
@PatrikElfstrom
Copy link

I prefer not to build a new image if I don't have to.
I like to just use docker-compose something like this:

grafana:
    image: grafana/grafana
    environment:
      - PGID=1000
      - PUID=1000
    volumes:
      - grafana:/var/lib/grafana

@papagian papagian removed the needs more info Issue needs more information, like query results, dashboard or panel json, grafana version etc label Nov 12, 2020
@aknuds1
Copy link
Contributor

aknuds1 commented Dec 2, 2020

@xlson Do you know if this is still a problem?

@aknuds1 aknuds1 removed their assignment Dec 2, 2020
@Subtixx
Copy link

Subtixx commented Mar 18, 2021

Still a problem for me. Cannot run grafana on Synology docker due to this.

@marefr
Copy link
Member

marefr commented Mar 24, 2021

Have you tried specifying a different user in docker/docker compose, see "Run Docker as a different user" section in https://grafana.com/docs/grafana/latest/installation/docker/#migrate-to-v51-or-later

@marefr marefr added the needs more info Issue needs more information, like query results, dashboard or panel json, grafana version etc label Mar 24, 2021
@marefr marefr removed this from To do in Backend Platform Squad Mar 24, 2021
@Subtixx
Copy link

Subtixx commented Mar 24, 2021

This doesn't work on a synology NAS, since you cant specifiy anything in the docker ui in synology for the docker compose

@ivanahuckova ivanahuckova added this to Inbox in Backend Platform Backlog via automation May 17, 2021
@ivanahuckova ivanahuckova removed the needs more info Issue needs more information, like query results, dashboard or panel json, grafana version etc label May 17, 2021
@dsotirakis dsotirakis removed this from Inbox in Backend Platform Backlog May 26, 2021
@modem7
Copy link

modem7 commented Aug 11, 2021

Can confirm this is still an issue, realistically one should be able to define a user/group that the container runs as (similar to any linuxserver.io image).

My "workaround" so far is to chown the persistent data directory on the host system to 472:472 (which doesn't exist), but this isn't optimal.

It seems someone has already managed it in a custom image: https://github.com/homecentr/docker-grafana and https://hub.docker.com/r/woahbase/alpine-grafana/ - may be worthwhile examining.

Copy link
Contributor

This issue has been automatically marked as stale because it has not had activity in the last year. It will be closed in 30 days if no further activity occurs. Please feel free to leave a comment if you believe the issue is still relevant. Thank you for your contributions!

@github-actions github-actions bot added the stale Issue with no recent activity label Jan 21, 2024
@modem7
Copy link

modem7 commented Jan 21, 2024

Stalebot Bump

@github-actions github-actions bot removed the stale Issue with no recent activity label Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants