# Choisissez l'UID et le GID de l'utilisateur à l'intérieur du conteneur

**URL:** <https://meta.discourse.org/t/choose-the-user-puid-and-pgid-inside-the-container/113309>\
**Category:** Development\
**Created:** [Avril 3, 2019, 7:24 UTC](https://meta.discourse.org/t/choose-the-user-puid-and-pgid-inside-the-container/113309 "2019-04-03T07:24:30Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![vitorl](https://avatars.discourse-cdn.com/v4/letter/v/57b2e6/32.png) [@vitorl](https://meta.discourse.org/u/vitorl)\
**Post date:** [Avril 3, 2019, 7:24 UTC](https://meta.discourse.org/t/choose-the-user-puid-and-pgid-inside-the-container/113309/1 "2019-04-03T07:24:30Z")

</div>

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](https://meta.discourse.org/t/problem-with-docker-installation/94700)

---

_[View the full topic](https://meta.discourse.org/t/choose-the-user-puid-and-pgid-inside-the-container/113309)._
