PUID/PGID changes

This commit is contained in:
Ryan
2025-04-22 08:19:10 -04:00
committed by GitHub
parent 6ff4aa5f34
commit ca3e2f316c
2 changed files with 10 additions and 2 deletions

View File

@@ -9,6 +9,7 @@
- `wwwdata` user is remapped at buildtime to the supplied `PUID:PGID`, then Apache drops privileges to that user - `wwwdata` user is remapped at buildtime to the supplied `PUID:PGID`, then Apache drops privileges to that user
- Unraid template: removed recommendation to use `--user`; replaced with `PUID`, `PGID`, and `Container Port` variables - Unraid template: removed recommendation to use `--user`; replaced with `PUID`, `PGID`, and `Container Port` variables
- “Permission denied” errors when forcing `--user 99:100` on Unraid by ensuring startup runs as root - “Permission denied” errors when forcing `--user 99:100` on Unraid by ensuring startup runs as root
- Silence group issue
--- ---

View File

@@ -66,8 +66,15 @@ RUN apt-get update && \
# Remap www-data to the PUID/PGID provided # Remap www-data to the PUID/PGID provided
RUN set -eux; \ RUN set -eux; \
if [ "$(id -u www-data)" != "${PUID}" ]; then usermod -u "${PUID}" www-data; fi; \ # only change the UID if its not already correct
if [ "$(id -g www-data)" != "${PGID}" ]; then groupmod -g "${PGID}" www-data; fi; \ if [ "$(id -u www-data)" != "${PUID}" ]; then \
usermod -u "${PUID}" www-data; \
fi; \
# attempt to change the GID, but ignore “already exists” errors
if [ "$(id -g www-data)" != "${PGID}" ]; then \
groupmod -g "${PGID}" www-data 2>/dev/null || true; \
fi; \
# finally set www-datas primary group to PGID (will succeed if the group exists)
usermod -g "${PGID}" www-data usermod -g "${PGID}" www-data
# Copy application tuning and code # Copy application tuning and code