Open raymond-chetty opened 1 year ago
Hi 👋
The base:debian
image already adds the common-utils
Feature with GID 1000 to the image (See here). Hence, GID 1000 exists at image level
F1 -> Add Dev Container Configuration Files... -> Create new configuration -> Debian -> bullseye -> Common utilities -> meson -> bazel -> android sdk -> android sdk platform tools -> ok -> configure options -> emulator -> ok -> 33 -> 33.0.2 -> v1.15.0 -> nonFreePackages -> ok -> devcontainer -> 1000 -> 1000
As you are trying to add the common-utils
Feature again on top of the image, it errors out as the GID is already allocated by the image to the vscode
user.
@raymond-chetty Can you use a different GID and see if it helps?
@joshspicer If I enter some value and click on ☑️ then nothing happens, is this a bug?
Is there a way to override the feature configuration used in the base image?
Maybe there is a way to use Metadata, options, or environment variables? https://containers.dev/implementors/json_reference/ https://containers.dev/implementors/features/#user-env-var https://containers.dev/implementors/spec/#image-metadata
I see remoteUser & containerUser have a last value wins merge logic, but nothing for groups except that some kind of sync gets done if a value is set to avoid bind mount problems. Maybe that is an implementation detail of github or limitation of devcontainers. https://containers.dev/implementors/spec/#container-creation
I probably shouldn't set the IDs, there isn't a reason for me currently, I mostly thought that the generated code wasn't working in a way that it seemed it should. And didn't recall it was mentioned in the base image documentation.
https://github.com/devcontainers/images/tree/main/src/base-debian
Beyond git, this image / Dockerfile includes zsh, [Oh My Zsh!](https://ohmyz.sh/), a non-root vscode user with sudo access, and a set of common dependencies for development.
Possible things.... Improved documentation might be a good result from this issue if there isn't a code change that is needed to allow customization of GID to 1000. It doesn't say common-utils is added as a feature on the base image README.md... or that UID and GID 1000 are taken by the vscode user. Updating the install script not to assume that an addgroup call is needed and use usermod if the group already exists is another outcome, though it might be unintuitive.
From a user perspective, if I was just trying things out, I would expect that codespaces and vscode would allow me to create the devcontainer with a GID as 1000 if I followed the steps I described, but that might be a Microsoft & vscode issue.
You can close the issue as you see fit.
Is there a way to override the feature configuration used in the base image?
Unfortunately, I don't think there is a way to currently override the GID used by the base image.
Maybe there is a way to use Metadata, options, or environment variables? https://containers.dev/implementors/json_reference/ https://containers.dev/implementors/features/#user-env-var https://containers.dev/implementors/spec/#image-metadata
I see remoteUser & containerUser have a last value wins merge logic, but nothing for groups except that some kind of sync gets done if a value is set to avoid bind mount problems. Maybe that is an implementation detail of github or limitation of devcontainers. https://containers.dev/implementors/spec/#container-creation
remoteUser
& containerUser
are properties of the devcontainer.json
. However, gid
is an option provided by the common-utils
Feature, hence, I don't suspect that we would resolve gid
with the merge logic which currently exists. However, if you think otherwise, then feel free to open a spec issue and provide your ideas/insights on how you would like to tackle this from the spec perspective.
Improved documentation might be a good result from this issue if there isn't a code change that is needed to allow customization of GID to 1000. It doesn't say common-utils is added as a feature on the base image README.md...
I agree that we should improve our documentation and add such details to avoid confusion. @raymond-chetty Would you be willing to contribute a PR with doc updates? We'd appreciate it.
It looks like it is an error to set the GID to 1000 when installing the common-utils feature on a debian base in codespaces. It's possible this is a codespaces issue... or maybe the base image includes a common-utils feature which creates a 1000 group. Once created the id isn't overridden in the codespaces devcontainer.json file that includes the feature.
https://github.com/devcontainers/images/blob/main/src/base-debian/.devcontainer/devcontainer.json#L7 https://github.com/devcontainers/features/blob/main/src/common-utils/main.sh#L362
I created the devcontainer.json below using the vscode wizard in github codespaces.... F1 -> Add Dev Container Configuration Files... -> Create new configuration -> Debian -> bullseye -> Common utilities -> meson -> bazel -> android sdk -> android sdk platform tools -> ok -> configure options -> emulator -> ok -> 33 -> 33.0.2 -> v1.15.0 -> nonFreePackages -> ok -> devcontainer -> 1000 -> 1000
Thanks!