Fix transmission container: handle existing user from package
Some checks failed
Build Container / build (push) Failing after 7s
Some checks failed
Build Container / build (push) Failing after 7s
This commit is contained in:
parent
b3c59b1dd0
commit
01f1b60b23
2 changed files with 13 additions and 13 deletions
|
|
@ -13,11 +13,8 @@ RUN apk add --no-cache \
|
||||||
tzdata \
|
tzdata \
|
||||||
su-exec
|
su-exec
|
||||||
|
|
||||||
# Create transmission user
|
# Create directories (user is created dynamically by start.sh based on PUID/PGID)
|
||||||
RUN addgroup -g 1000 transmission && \
|
RUN mkdir -p /config /downloads/complete /downloads/incomplete
|
||||||
adduser -D -u 1000 -G transmission transmission && \
|
|
||||||
mkdir -p /config /downloads/complete /downloads/incomplete && \
|
|
||||||
chown -R transmission:transmission /config /downloads
|
|
||||||
|
|
||||||
COPY --chmod=755 start.sh /start.sh
|
COPY --chmod=755 start.sh /start.sh
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,14 +5,17 @@ set -e
|
||||||
PUID=${PUID:-1000}
|
PUID=${PUID:-1000}
|
||||||
PGID=${PGID:-1000}
|
PGID=${PGID:-1000}
|
||||||
|
|
||||||
# Update transmission user UID/GID if different from default
|
# Create or update transmission group/user with requested UID/GID
|
||||||
if [ "$PUID" != "1000" ] || [ "$PGID" != "1000" ]; then
|
# The transmission package may have created a user with different IDs
|
||||||
echo "Updating transmission user to UID=$PUID GID=$PGID"
|
echo "Setting up transmission user with UID=$PUID GID=$PGID"
|
||||||
deluser transmission 2>/dev/null || true
|
|
||||||
delgroup transmission 2>/dev/null || true
|
# Remove existing user/group if they exist (ignore errors)
|
||||||
addgroup -g "$PGID" transmission
|
deluser transmission 2>/dev/null || true
|
||||||
adduser -D -u "$PUID" -G transmission transmission
|
delgroup transmission 2>/dev/null || true
|
||||||
fi
|
|
||||||
|
# Create fresh user/group with requested IDs
|
||||||
|
addgroup -g "$PGID" transmission
|
||||||
|
adduser -D -u "$PUID" -G transmission transmission
|
||||||
|
|
||||||
# Ensure directories exist with correct ownership
|
# Ensure directories exist with correct ownership
|
||||||
mkdir -p /config /downloads/complete /downloads/incomplete
|
mkdir -p /config /downloads/complete /downloads/incomplete
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue