From 01f1b60b23bc4495c1625f0d1a40df3a376c159e Mon Sep 17 00:00:00 2001 From: Erich Blume Date: Sun, 25 Jan 2026 21:13:11 -0800 Subject: [PATCH] Fix transmission container: handle existing user from package --- containers/transmission/Dockerfile | 7 ++----- containers/transmission/start.sh | 19 +++++++++++-------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/containers/transmission/Dockerfile b/containers/transmission/Dockerfile index 943b0f7..3f418cd 100644 --- a/containers/transmission/Dockerfile +++ b/containers/transmission/Dockerfile @@ -13,11 +13,8 @@ RUN apk add --no-cache \ tzdata \ su-exec -# Create transmission user -RUN addgroup -g 1000 transmission && \ - adduser -D -u 1000 -G transmission transmission && \ - mkdir -p /config /downloads/complete /downloads/incomplete && \ - chown -R transmission:transmission /config /downloads +# Create directories (user is created dynamically by start.sh based on PUID/PGID) +RUN mkdir -p /config /downloads/complete /downloads/incomplete COPY --chmod=755 start.sh /start.sh diff --git a/containers/transmission/start.sh b/containers/transmission/start.sh index d49f1bb..85d5f8c 100644 --- a/containers/transmission/start.sh +++ b/containers/transmission/start.sh @@ -5,14 +5,17 @@ set -e PUID=${PUID:-1000} PGID=${PGID:-1000} -# Update transmission user UID/GID if different from default -if [ "$PUID" != "1000" ] || [ "$PGID" != "1000" ]; then - echo "Updating transmission user to UID=$PUID GID=$PGID" - deluser transmission 2>/dev/null || true - delgroup transmission 2>/dev/null || true - addgroup -g "$PGID" transmission - adduser -D -u "$PUID" -G transmission transmission -fi +# Create or update transmission group/user with requested UID/GID +# The transmission package may have created a user with different IDs +echo "Setting up transmission user with UID=$PUID GID=$PGID" + +# Remove existing user/group if they exist (ignore errors) +deluser transmission 2>/dev/null || true +delgroup transmission 2>/dev/null || true + +# Create fresh user/group with requested IDs +addgroup -g "$PGID" transmission +adduser -D -u "$PUID" -G transmission transmission # Ensure directories exist with correct ownership mkdir -p /config /downloads/complete /downloads/incomplete