diff --git a/src/dotnet/.devcontainer/Dockerfile b/src/dotnet/.devcontainer/Dockerfile index 649e306b4..acd613d4c 100644 --- a/src/dotnet/.devcontainer/Dockerfile +++ b/src/dotnet/.devcontainer/Dockerfile @@ -2,6 +2,15 @@ ARG VARIANT=9.0-bookworm-slim FROM mcr.microsoft.com/dotnet/sdk:${VARIANT} ENV PATH $PATH:/home/vscode/.dotnet:/home/vscode/.dotnet/tools +ARG VARIANT +RUN if [ "${VARIANT#*noble}" != "$VARIANT" ]; then \ + if id "ubuntu" &>/dev/null; then \ + echo "Deleting user 'ubuntu' for $VARIANT" && userdel -f -r ubuntu || echo "Failed to delete ubuntu user for $VARIANT"; \ + else \ + echo "User 'ubuntu' does not exist for $VARIANT"; \ + fi; \ + fi + # clear this environment variable so xml docs from NuGet packages are unpackaged. The default dotnet/sdk image sets it to 'skip'. # see https://github.com/dotnet/dotnet-docker/issues/2790 ENV NUGET_XMLDOC_MODE= \ No newline at end of file diff --git a/src/dotnet/.devcontainer/devcontainer.json b/src/dotnet/.devcontainer/devcontainer.json index 141b6263e..e6e6a919b 100644 --- a/src/dotnet/.devcontainer/devcontainer.json +++ b/src/dotnet/.devcontainer/devcontainer.json @@ -7,7 +7,9 @@ "ghcr.io/devcontainers/features/common-utils:2": { "installZsh": "true", "username": "vscode", - "upgradePackages": "true" + "upgradePackages": "true", + "userUid": "1000", + "userGid": "1000" }, "ghcr.io/devcontainers/features/node:1": { "version": "none"