[PR #97] [MERGED] Configure retro user UID and GID on container startups #151

Closed
opened 2026-10-15 12:49:30 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/games-on-whales/gow/pull/97
Author: @Josh5
Created: 10/15/2022
Status: ✅ Merged
Merged: 2/6/2023
Merged by: @ABeltramo

Base: master ← Head: dev-retro-user


📝 Commits (10+)

  • 0a13e51 Update base image to allow UID and GID to be set on container startup
  • ca916fa Allow use of docker-compose command
  • 0579812 Uns POSIX compliant function syntax
  • d017e20 Remove 'USER_PASSWORD' from base image
  • 1992c74 Add PUID and PGID env variables to common.env and user.env files
  • b3ef0a3 Remove 'sudo' from project
  • 4b9cf36 Fix services that should run as user to run such using gosu
  • 16e9252 Wrap bash vars in "
  • 8cef2b7 Configure default user for services that will run as root
  • ef20d36 Ensure the home directory is owned by PUID:PGID on startup

📊 Changes

25 files changed (+192 additions, -123 deletions)

View changed files

📝 compose/apps/steam.yml (+0 -1)
📝 config/common.env (+3 -0)
📝 images/base-app/Dockerfile (+2 -0)
📝 images/base/Dockerfile (+50 -30)
➖ images/base/build/setup-retro-user (+0 -29)
➕ images/base/overlay/entrypoint.sh (+28 -0)
➕ images/base/overlay/etc/cont-init.d/10-setup_user.sh (+25 -0)
➕ images/base/overlay/etc/cont-init.d/15-setup_devices.sh (+14 -0)
➕ images/base/overlay/opt/gow/bash-lib/utils.sh (+7 -0)
📝 images/base/overlay/opt/gow/ensure-groups (+4 -4)
➕ images/base/overlay/opt/gow/startup.sh (+6 -0)
➖ images/base/scripts/bootstrap.sh (+0 -18)
➖ images/base/scripts/lib/utils.sh (+0 -7)
📝 images/pulseaudio/Dockerfile (+11 -7)
📝 images/retroarch/Dockerfile (+0 -3)
📝 images/steam/Dockerfile (+0 -2)
📝 images/steam/scripts/startup.sh (+1 -1)
📝 images/sunshine/Dockerfile (+0 -2)
📝 images/sunshine/scripts/startup.sh (+1 -1)
📝 images/udevd/Dockerfile (+5 -0)

...and 5 more files

📄 Description

To achieve this, I have switched out our init to always run as root for all containers. This will carry out any root user config and then, if the container should exec the process as an unprivileged user, this init will use gosu to drop down to that user.

This work removes all requirement for sudo inside the container.
This has the benefit of PID 1 always being the service that is running rather than sudo exec <command>. PID 1 will always receive all SIG calls from Docker and therefore, when we terminate the container we will be making that CLI directly to the service running inside - EG. sunshine, steam, etc.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/games-on-whales/gow/pull/97 **Author:** [@Josh5](https://github.com/Josh5) **Created:** 10/15/2022 **Status:** ✅ Merged **Merged:** 2/6/2023 **Merged by:** [@ABeltramo](https://github.com/ABeltramo) **Base:** `master` ← **Head:** `dev-retro-user` --- ### 📝 Commits (10+) - [`0a13e51`](https://github.com/games-on-whales/gow/commit/0a13e51dddd7e0b5b9de931387d302ca74219093) Update base image to allow UID and GID to be set on container startup - [`ca916fa`](https://github.com/games-on-whales/gow/commit/ca916fa0fc40fb71f8f98b65def48945207cf047) Allow use of `docker-compose` command - [`0579812`](https://github.com/games-on-whales/gow/commit/0579812ae2af32908fe0d0531add31755df8f8ab) Uns POSIX compliant function syntax - [`d017e20`](https://github.com/games-on-whales/gow/commit/d017e20d01e47f52c16f222fa4c35fa169cc17cb) Remove 'USER_PASSWORD' from base image - [`1992c74`](https://github.com/games-on-whales/gow/commit/1992c74cc660424b1bd63083e24d6941a2ae0e1b) Add PUID and PGID env variables to common.env and user.env files - [`b3ef0a3`](https://github.com/games-on-whales/gow/commit/b3ef0a3c1930ca66967ba642f888c7bbcea2a421) Remove 'sudo' from project - [`4b9cf36`](https://github.com/games-on-whales/gow/commit/4b9cf369eea393c989506f58864078953b3cb8f3) Fix services that should run as user to run such using gosu - [`16e9252`](https://github.com/games-on-whales/gow/commit/16e9252ee6aa60777602508964312dd1184babae) Wrap bash vars in " - [`8cef2b7`](https://github.com/games-on-whales/gow/commit/8cef2b727021f5b6103eb1b30eab519f0728554e) Configure default user for services that will run as root - [`ef20d36`](https://github.com/games-on-whales/gow/commit/ef20d3609e94e96f89caa01b661ec8b2c443a370) Ensure the home directory is owned by PUID:PGID on startup ### 📊 Changes **25 files changed** (+192 additions, -123 deletions) <details> <summary>View changed files</summary> 📝 `compose/apps/steam.yml` (+0 -1) 📝 `config/common.env` (+3 -0) 📝 `images/base-app/Dockerfile` (+2 -0) 📝 `images/base/Dockerfile` (+50 -30) ➖ `images/base/build/setup-retro-user` (+0 -29) ➕ `images/base/overlay/entrypoint.sh` (+28 -0) ➕ `images/base/overlay/etc/cont-init.d/10-setup_user.sh` (+25 -0) ➕ `images/base/overlay/etc/cont-init.d/15-setup_devices.sh` (+14 -0) ➕ `images/base/overlay/opt/gow/bash-lib/utils.sh` (+7 -0) 📝 `images/base/overlay/opt/gow/ensure-groups` (+4 -4) ➕ `images/base/overlay/opt/gow/startup.sh` (+6 -0) ➖ `images/base/scripts/bootstrap.sh` (+0 -18) ➖ `images/base/scripts/lib/utils.sh` (+0 -7) 📝 `images/pulseaudio/Dockerfile` (+11 -7) 📝 `images/retroarch/Dockerfile` (+0 -3) 📝 `images/steam/Dockerfile` (+0 -2) 📝 `images/steam/scripts/startup.sh` (+1 -1) 📝 `images/sunshine/Dockerfile` (+0 -2) 📝 `images/sunshine/scripts/startup.sh` (+1 -1) 📝 `images/udevd/Dockerfile` (+5 -0) _...and 5 more files_ </details> ### 📄 Description To achieve this, I have switched out our init to always run as root for all containers. This will carry out any root user config and then, if the container should exec the process as an unprivileged user, this init will use `gosu` to drop down to that user. This work removes all requirement for `sudo` inside the container. This has the benefit of PID 1 always being the service that is running rather than `sudo exec <command>`. PID 1 will always receive all SIG calls from Docker and therefore, when we terminate the container we will be making that CLI directly to the service running inside - EG. sunshine, steam, etc. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-15 12:49:30 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
games-on-whales/gow#151
No description provided.