envd: bug: bad permission in current working directory
Description
There is a permission issue when the CWD has difference UID, GID with the USER in container.
I used to fix this issue with --user $(id -u):$(id -g) in docker-cli or create and switch to the new user in the Dockerfile
I didn’t find the user configuration in build.envd. It may be a new feature.
Reproduction
(envd) ➜ envd-quick-start whoami
envd
(envd) ➜ envd-quick-start id
uid=1000(envd) gid=1000(envd) groups=1000(envd),27(sudo)
(envd) ➜ envd-quick-start ll
total 28K
-rw-rw-r-- 1 1042 1042 12K Jun 16 02:54 LICENSE
-rw-rw-r-- 1 1042 1042 4.4K Jun 16 02:54 README.md
-rw-rw-r-- 1 1042 1042 250 Jun 16 03:16 build.envd
-rw-rw-r-- 1 1042 1042 54 Jun 16 02:54 demo.py
(envd) ➜ envd-quick-start touch new_file
touch: cannot touch 'new_file': Permission denied
Additional Info
Maybe related to issue #343, see also VS Code devcontainer add non-root user
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 23 (23 by maintainers)
It should be fixed in the new release, please give it another try with
It is interesting. I think the best option is UID remapping but I am not sure if it is possible. Or we should have a similar mechanism with vscode dev container.
@gaocegege if envd can remapping
UIDandGIDat runtime that will be great. I’m also agree with @Zheaoli that if UID/GID remapping is doable there should be an API or config option allowing user to modify it.I’ve used VSCode Dev Container with some projects, and I found that they also need to fix this UID/GID issue. https://github.com/microsoft/vscode-dev-containers/blob/main/containers/python-3/.devcontainer/library-scripts/common-debian.sh#L182
As far as I understand it, they fix it in build time but not build from scratch. The base Dockerfile has several build args. The user firstly downloads the base image and re-builds it with new args e.g., NEW_UID, NEW_GID.
Here is the build log I captured from VSCode console: