From 96e1863a6891a4e18768581a3d3cdc1d87905b1f Mon Sep 17 00:00:00 2001 From: Alex Shnitman Date: Fri, 6 Feb 2026 15:31:01 +0200 Subject: [PATCH] change UID/GID to PUID/PGID; legacy name also supported (#889) --- Dockerfile | 4 ++-- README.md | 4 ++-- docker-entrypoint.sh | 17 ++++++++++------- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 53f4283..045c68d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -69,8 +69,8 @@ RUN BGUTIL_TAG="$(curl -Ls -o /dev/null -w '%{url_effective}' https://github.com COPY app ./app COPY --from=builder /metube/dist/metube ./ui/dist/metube -ENV UID=1000 -ENV GID=1000 +ENV PUID=1000 +ENV PGID=1000 ENV UMASK=022 ENV DOWNLOAD_DIR /downloads diff --git a/README.md b/README.md index 248a4e4..6019378 100644 --- a/README.md +++ b/README.md @@ -73,8 +73,8 @@ Certain values can be set via environment variables, using the `-e` parameter on ### 🏠 Basic Setup -* __UID__: User under which MeTube will run. Defaults to `1000`. -* __GID__: Group under which MeTube will run. Defaults to `1000`. +* __PUID__: User under which MeTube will run. Defaults to `1000` (legacy `UID` also supported). +* __PGID__: Group under which MeTube will run. Defaults to `1000` (legacy `GID` also supported). * __UMASK__: Umask value used by MeTube. Defaults to `022`. * __DEFAULT_THEME__: Default theme to use for the UI, can be set to `light`, `dark`, or `auto`. Defaults to `auto`. * __LOGLEVEL__: Log level, can be set to `DEBUG`, `INFO`, `WARNING`, `ERROR`, `CRITICAL`, or `NONE`. Defaults to `INFO`. diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh index b907d61..5f07bc5 100644 --- a/docker-entrypoint.sh +++ b/docker-entrypoint.sh @@ -1,22 +1,25 @@ #!/bin/sh +PUID="${UID:-$PUID}" +PGID="${GID:-$PGID}" + echo "Setting umask to ${UMASK}" umask ${UMASK} echo "Creating download directory (${DOWNLOAD_DIR}), state directory (${STATE_DIR}), and temp dir (${TEMP_DIR})" mkdir -p "${DOWNLOAD_DIR}" "${STATE_DIR}" "${TEMP_DIR}" if [ `id -u` -eq 0 ] && [ `id -g` -eq 0 ]; then - if [ "${UID}" -eq 0 ]; then - echo "Warning: it is not recommended to run as root user, please check your setting of the UID environment variable" + if [ "${PUID}" -eq 0 ]; then + echo "Warning: it is not recommended to run as root user, please check your setting of the PUID/PGID (or legacy UID/GID) environment variables" fi if [ "${CHOWN_DIRS:-true}" != "false" ]; then - echo "Changing ownership of download and state directories to ${UID}:${GID}" - chown -R "${UID}":"${GID}" /app "${DOWNLOAD_DIR}" "${STATE_DIR}" "${TEMP_DIR}" + echo "Changing ownership of download and state directories to ${PUID}:${PGID}" + chown -R "${PUID}":"${PGID}" /app "${DOWNLOAD_DIR}" "${STATE_DIR}" "${TEMP_DIR}" fi echo "Starting BgUtils POT Provider" - gosu "${UID}":"${GID}" bgutil-pot server >/tmp/bgutil-pot.log 2>&1 & - echo "Running MeTube as user ${UID}:${GID}" - exec gosu "${UID}":"${GID}" python3 app/main.py + gosu "${PUID}":"${PGID}" bgutil-pot server >/tmp/bgutil-pot.log 2>&1 & + echo "Running MeTube as user ${PUID}:${PGID}" + exec gosu "${PUID}":"${PGID}" python3 app/main.py else echo "User set by docker; running MeTube as `id -u`:`id -g`" echo "Starting BgUtils POT Provider"