From 981e455211ffaa7a96e29711bca1552cd8d3b1a4 Mon Sep 17 00:00:00 2001 From: Junlin Zhou Date: Fri, 5 Sep 2025 09:55:22 +0800 Subject: [PATCH] feat: remove default 'ubuntu' user on Ubuntu 23.04+ Starting from Ubuntu 23.04, the system includes a default 'ubuntu' user (UID 1000) to serve as a non-root OCI user. This cause errors when building the base image: `useradd: UID 1000 is not unique`. Since we don't need the default 'ubuntu' user, this commit removes it. Original PR: Signed-off-by: Junlin Zhou --- components/example-notebook-servers/base/Dockerfile | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/components/example-notebook-servers/base/Dockerfile b/components/example-notebook-servers/base/Dockerfile index e906276ef..749c5b62f 100644 --- a/components/example-notebook-servers/base/Dockerfile +++ b/components/example-notebook-servers/base/Dockerfile @@ -102,7 +102,10 @@ RUN curl -fsSL "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/${TARGETA && chmod +x /usr/local/bin/kubectl # create user and set required ownership -RUN useradd -M -N \ +# Starting with Ubuntu 23.04, the system includes a default user named 'ubuntu' with UID 1000, +# which conflicts with our default NB_UID. As this user is not needed, it is removed. +RUN userdel -r ubuntu || true \ + && useradd -M -N \ --shell /bin/bash \ --home ${HOME} \ --uid ${NB_UID} \