agent icon indicating copy to clipboard operation
agent copied to clipboard

No variables PUID and PGID

Open neutralvibes opened this issue 2 years ago • 5 comments

Seems as if agents are forced to run as '100:101' in container. Not nice. Would be nicer if what now appears to be a standard is used.


environment:
  PUID=1005 # User
  PGID=102 # Group
  othervars=....

This will also allow for required user access outside the container without requiring root. Forgive me if there is already a way to do this.

neutralvibes avatar Jul 17 '23 13:07 neutralvibes

Thanks you are making a valid point. For the moment we are creating a new user (without root privileges) inside the container. https://github.com/kerberos-io/agent/blob/master/Dockerfile#L96-L99

We might need to change this to allow host user access. Will need to be researched and documented. Thank you for your insights! ;)

cedricve avatar Jul 17 '23 18:07 cedricve

Yes please add PUID and GID variables. I recently moved my agent docker container to openmediavault but I think it's failing to record events due to permissions problems and normally this is fixed by having the user/group ID configurable via variables (see also linuxserver's docker containers)

yllekz avatar Aug 19 '23 22:08 yllekz

Would this be sufficient (https://docs.linuxserver.io/general/understanding-puid-and-pgid). It mentions:

We are aware that recent versions of the Docker engine have introduced the --user flag. Our images are not yet compatible with this, so we recommend continuing usage of PUID and PGID.

Would this work as well? https://docs.docker.com/engine/reference/run/#user

Currently we create our own user within the agent, and set it as the user: https://github.com/kerberos-io/agent/blob/master/Dockerfile#L134

I believe this could be bypassed as follow:

docker run -p 80:80 --name mycamera  --user=uid:gid -d --restart=always kerberos/agent:latest

cedricve avatar Aug 20 '23 18:08 cedricve

@yllekz @neutralvibes any thoughts?

cedricve avatar Sep 07 '23 06:09 cedricve

Just came across this issue, for K8S if I set runAsNonRoot: true, I will also need to set runAsUser: <uid>. @cedricve From the dockerfile I can see there is an non-root user, but there seems not to be an uid set for the user? A static UID would be nice and easier for config

winston0410 avatar Jun 28 '24 09:06 winston0410