Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project workspace directory in Rust dev container owned by root user #1010

Closed
0x47 opened this issue Mar 31, 2024 · 2 comments
Closed

Project workspace directory in Rust dev container owned by root user #1010

0x47 opened this issue Mar 31, 2024 · 2 comments

Comments

@0x47
Copy link

0x47 commented Mar 31, 2024

I am trying to use the Rust dev container from a Linux system with a user with UID 1001 and GID 1001 via rootless Docker. As such, the permissions for the vscode user in the home directory seem to work fine:

Dev container home folder:

$ ls -lahn /home/vscode/
total 56K
drwxr-xr-x 1 1001 1001 4.0K Mar 31 22:59 .
drwxr-xr-x 1    0    0 4.0K Mar  5 18:13 ..
-rw-r--r-- 1 1001 1001  220 Mar 27  2022 .bash_logout
-rw-r--r-- 1 1001 1001 4.9K Mar  5 18:13 .bashrc
[...]
drwxr-xr-x 6 1001 1001 4.0K Mar 31 22:59 .vscode-server
-rw-r--r-- 1 1001 1001   22 Mar  5 18:13 .zprofile
-rw-r--r-- 1 1001 1001 3.9K Mar  5 18:13 .zshrc

However, the workspace /workspaces/project itself is mounted being owned by root (UID=0 and GID=0):

$ ls -lahn
total 120K
drwxrwxr-x 8 0 0 4.0K Mar 31 20:53 .
drwxr-xr-x 3 0 0 4.0K Mar 31 22:59 ..
-rw-rw-r-- 1 0 0  69K Mar 31 20:05 Cargo.lock
-rw-rw-r-- 1 0 0  303 Mar 31 20:05 Cargo.toml
drwxrwxr-x 2 0 0 4.0K Mar 31 20:05 data
drwxrwxr-x 2 0 0 4.0K Mar 31 21:48 .devcontainer
[...]
drwxrwxr-x 6 0 0 4.0K Mar 31 20:05 src

In contrast, the host project directory is owned by UID/GID 1001:

$ ls -lahn
total 120K
drwxrwxr-x  8 1001 1001 4.0K Mar 31 20:53 .
drwxrwxr-x 13 1001 1001 4.0K Mar 31 20:05 ..
drwxrwxr-x  2 1001 1001 4.0K Mar 31 21:48 .devcontainer
drwxrwxr-x  8 1001 1001 4.0K Mar 31 20:05 .git
drwxrwxr-x  2 1001 1001 4.0K Mar 31 20:53 .github
-rw-rw-r--  1 1001 1001   32 Mar 31 20:05 .gitignore
-rw-rw-r--  1 1001 1001  69K Mar 31 20:05 Cargo.lock
[...]
drwxrwxr-x  6 1001 1001 4.0K Mar 31 20:05 src

When changing the owner UID/GID in the container to 1001:1001, the host permissions are screwed up:

$ ls -lahn
total 124K
drwxrwxr-x  9 166536 166536 4.0K Apr  1 09:58 .
drwxrwxr-x 13   1001   1001 4.0K Mar 31 20:05 ..
drwxrwxr-x  2 166536 166536 4.0K Mar 31 21:48 .devcontainer
drwxrwxr-x  8 166536 166536 4.0K Mar 31 20:05 .git
drwxrwxr-x  2 166536 166536 4.0K Mar 31 20:53 .github
-rw-rw-r--  1 166536 166536   32 Mar 31 20:05 .gitignore
-rw-rw-r--  1 166536 166536  69K Mar 31 20:05 Cargo.lock
[...]
drwxrwxr-x  6 166536 166536 4.0K Mar 31 20:05 src
drwxr-xr-x  3 166536 166536 4.0K Apr  1 09:58 target

This is my devcontainer.json:

{
	"name": "Rust",
	"image": "mcr.microsoft.com/devcontainers/rust:1-1-bullseye",

	"remoteUser": "vscode",
	"containerUser": "vscode",
	"updateRemoteUserUID": true,
	"runArgs": [
		"-u",
		"1001:1001"
	]
}

I added the last four entries trying to fix the issue, alas without success.

@0x47
Copy link
Author

0x47 commented Apr 1, 2024

The issue is being discussed at microsoft/vscode-remote-release#4646

@0x47
Copy link
Author

0x47 commented Apr 1, 2024

Closing because this is an upstream issue

@0x47 0x47 closed this as completed Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant