Skip to content

Commit

Permalink
IDE: adjust the Docker env used by devcontainer
Browse files Browse the repository at this point in the history
The base Docker image generated and made available by Microsoft [a]
already has an ubuntu user (UID=1000) and a vscode user (UID=1001)
registered. No problem occurs if we directly run a container based
on this image, even selecting vscode as user, but for some reason,
when someone uses the VS Code feature [b], 'vscode-server' creates
a container based on the image [a] but it defines the user who runs
the container on the host as UID=1001 (a non-existent user on my host).

This results in access denied issues on any file edited using VS Code.
Therefore, we need to at least create a workaround, forcing the vscode
user to be UID=1000.

[a] mcr.microsoft.com/vscode/devcontainers/base:noble
[b] The Dev Containers extension lets you use a Docker container as
    a full-featured development environment.

Signed-off-by: Claudio André <[email protected]>
  • Loading branch information
claudioandre-br committed Jul 26, 2024
1 parent 15f025e commit 95fa6fd
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/actions/spelling/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ cyggomp
cygz
davidanson
debhelper
deluser
devcontainer
distro
dmg
Expand Down
1 change: 1 addition & 0 deletions IDE/.devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \

SHELL ["/bin/bash", "-o", "pipefail", "-c"]
RUN curl --proto '=https' --tlsv1.3 https://sh.rustup.rs -sSf | bash -s -- -y
RUN deluser --remove-home ubuntu

USER vscode
HEALTHCHECK NONE
1 change: 0 additions & 1 deletion IDE/.devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"name": "Ubuntu",
"remoteUser": "vscode",
"mounts": [
"source=/var/run/docker.sock,target=/var/run/docker-host.sock,type=bind"
],
Expand Down

0 comments on commit 95fa6fd

Please sign in to comment.