From e9c612d74ab80104eb51fb5bfa6895c70665d170 Mon Sep 17 00:00:00 2001 From: texhnolyze Date: Thu, 20 Jun 2024 18:13:18 +0200 Subject: [PATCH] fix(devcontainer): delete `users` group from container in `Dockerfile`, because the `updateRemoteUserUID` setting of the devcontainer does not change the `GID` of the `containerUser` dynamically to the one of the host user if the group exists in the container already microsoft/vscode-remote-release#2402. In our case the `containerUser` is set to `bitbots`, because it automatically uses the last `USER` instruction from the `Dockerfile` and the `remoteUser` inherits from `containerUser`. For reference see: microsoft/vscode-remote-release#1155 --- .devcontainer/Dockerfile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 5aee3c9db..917a89e7c 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -82,8 +82,12 @@ RUN python3 -m pip install \ # Set zsh as default shell SHELL ["/bin/zsh", "-c"] -# Create user bitbots with home directory and add to sudo group -RUN useradd -m -U -u "$uid" -G sudo -s /bin/zsh $user \ +# Remove the users group, because when it exists on the host system +# the devcontainer will not dynamically update the containerUser GID, +# when the host user is part of the users group. +# Then create a bitbots user with home directory and add allow it to use sudo +RUN groupdel users \ + && useradd -m -U -u "$uid" -G sudo -s /bin/zsh $user \ && groupmod -g "$gid" $user \ && echo "$user ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers