Skip to content

Commit 316dffe

Browse files
committed
Add user ubuntu in dev container
The user ubuntu is only introduced in the Docker image starting with version 24.04. The jammy LTS 22.04 does not yet have it. See https://bugs.launchpad.net/cloud-images/+bug/2005129 for details. Apart from being correct to add the user when it does not exist, this also represents a workaround for issues with dev container tools who do not add the user automatically when remoteUser is set. JetBrains dev container integration in CLion is affected by this. See for example https://youtrack.jetbrains.com/issue/IJPL-160538/DevContainers.-Fails-to-create-a-devcontainer-with-not-existing-remoteUser-with-unclear-message-No-Linux-Installation-Found-on
1 parent 08c0c72 commit 316dffe

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

docker/Dockerfile

+3-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ RUN bash -c "source /opt/build.sh; GetMcuBoot;"
6868
ARG USERNAME=ubuntu
6969

7070
# Setup the ubuntu user with sudo password "ubuntu" for developing in devcontainer
71-
RUN echo "$USERNAME:ubuntu" | chpasswd && usermod -aG sudo $USERNAME
71+
RUN useradd -m ubuntu \
72+
&& usermod -aG sudo $USERNAME \
73+
&& echo "$USERNAME:ubuntu" | chpasswd
7274

7375
RUN SNIPPET="export PROMPT_COMMAND='history -a' && export HISTFILE=/commandhistory/.bash_history" \
7476
&& mkdir /commandhistory \

0 commit comments

Comments
 (0)