leantime icon indicating copy to clipboard operation
leantime copied to clipboard

Add PUID and PGID environment variables to run docker container as non-root user

Open recklessnl opened this issue 4 years ago • 1 comments

Basically how every single LSIO docker container has it too: https://docs.linuxserver.io/general/understanding-puid-and-pgid

I want to run Leantime as a particular user, which would solve a lot of permission issues. In all LSIO containers I just set the PUID and PGID environment variables and boom, the containers runs as that user.

Would you add this feature? It makes managing Docker containers much easier.

recklessnl avatar Jun 05 '20 22:06 recklessnl

Just thought I'd add this information here for future reference - it's from an ongoing discussion over at the linuxserver.io discord.

The user is created in the dockerfile: https://github.com/linuxserver/docker-baseimage-alpine/blob/master/Dockerfile#L84 and configured in the init https://github.com/linuxserver/docker-baseimage-alpine/blob/master/root/etc/s6-overlay/s6-rc.d/init-adduser/run You cannot set permissions at build time because you don't know the uid and if you chmod everything to 777 you completely defeat the point of running as a non-root user (plus you break a bunch of things that demand specific permissions on files). Equally you can't use fixattrs because that runs before the rest of the container init

I'm continuing discussion to see if switching to the lsio base image would be a good idea - it should be in theory, since the current image uses alpine/supervisord, which is very similar to lsio's alpine/s6 combo. I'll update here and/or over on the leantime discord to continue the conversation.

TheRealGramdalf avatar Feb 26 '24 07:02 TheRealGramdalf

Just as an update: This hasn't been fixed quite yet, but It's in progress - the PR that ostensibly closes it is just phase one, which brings enough benefits that I figured it was worth it's own PR.

TheRealGramdalf avatar Mar 13 '24 01:03 TheRealGramdalf