Skip to content

Commit d9b9868

Browse files
committed
fix(docker): remove pre-existing UID-1000 user before useradd
Ubuntu 24.04+ images pre-create an `ubuntu` user at UID 1000. The Dockerfile defaults `PUID=1000` (the LinuxServer.io convention) and tries to `useradd -u 1000 installer`, which fails with exit code 4 (UID already in use). Removed the pre-existing user first so the installer user can claim UID 1000. The `if id -u ubuntu` guard keeps the step idempotent across Ubuntu images that do or don't ship the default user.
1 parent 3277326 commit d9b9868

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

Dockerfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,10 @@ RUN apt-get update \
7070
ARG PUID=1000
7171
ARG PGID=1000
7272

73-
RUN groupadd -g "$PGID" installer \
73+
# Ubuntu 24.04+ pre-creates an `ubuntu` user at UID 1000. Remove it so
74+
# our `installer` user can claim 1000 (the LinuxServer.io convention).
75+
RUN if id -u ubuntu >/dev/null 2>&1; then userdel -r ubuntu 2>/dev/null || true; fi \
76+
&& groupadd -g "$PGID" installer \
7477
&& useradd -m -u "$PUID" -g "$PGID" -s /bin/bash installer
7578

7679
WORKDIR /app

0 commit comments

Comments
 (0)