Skip to content

Commit

Permalink
fix: running the container with PUID=0 and PGID=0 (#3030)
Browse files Browse the repository at this point in the history
Co-authored-by: Hayden <64056131+hay-kot@users.noreply.github.com>
  • Loading branch information
xThaid and hay-kot committed Jan 27, 2024
1 parent 20621a1 commit 4d49e30
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions docker/entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ add_user() {
}

change_user() {
# If container is started as root then create a new user and switch to it
if [ "$(id -u)" = "0" ]; then
if [ "$(id -u)" = $PUID ]; then
echo "
User uid: $PUID
User gid: $PGID
"
elif [ "$(id -u)" = "0" ]; then
# If container is started as root then create a new user and switch to it
add_user
chown -R $PUID:$PGID /app

echo "Switching to dedicated user"
exec gosu $PUID "$BASH_SOURCE" "$@"
elif [ "$(id -u)" = $PUID ]; then
echo "
User uid: $PUID
User gid: $PGID
"
fi
}

Expand Down

0 comments on commit 4d49e30

Please sign in to comment.