Why isn’t there a way to choose the user PUID and PGID to avoid permission issues?
Also discourse is a public facing software, with user uploaded content so are stuff running as root by default?
There are many ways to fix this, from the Dockerfile itself, to post-boot scripts like s6-overlay.
I suggest creating a user called discourse inside the container and allowing us to start the docker with a variable like -e PUID=1020 then just run this simple shell command somewhere after boot:
groupmod -o -g “$PGID” discourse > /dev/null 2>&1
usermod -o -u “$PUID” discourse > /dev/null 2>&1
chown -R discourse:discourse /any/folder/discourse/needs
That will fix permission issues on the host, add consistency, and improve security.
Because of this I can’t get discourse back online after chown my
/opt directory which I store all my dockers and run all of them as any arbitrary user I want so I never have issues.
I have no way to guess which PID and GID the discourse container needs either. Not really good implementation.
Even after a rebuild, even if I rebuild as root, even if I rebuild as my docker user, the permissions are messed now, this could have been easily prevented with 2 variables and 3 shell commands after container boot.
I’m having the same issue as this guy after boot now…Problem with docker installation