-
Notifications
You must be signed in to change notification settings - Fork 302
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
Dev Containers: improve Podman compatibility (low-hanging fruit) #10399
Comments
Would disabling the UID update also work? (Try |
That's a good point. There is definitely chatter on the internet about Obviously, this would complicate the matter a bit. I wonder if it would be feasible to conditionally set |
I was wondering if disabling the UID update would be an alternative to |
I have tested on Fedora 41 with Visual Studio Code 1.96.0, Podman 5.3.1 and the following minimal {
"name": "C++",
"image": "mcr.microsoft.com/devcontainers/cpp:1-debian-12",
"containerEnv": {
"HOME": "/home/vscode"
},
"securityOpt": [
"label=disable"
],
"updateRemoteUserUID": false
} I varied The condition for success is the execution of the following shell command in the workspace directory inside the devcontainer: touch foo && rm foo On success this command prints nothing; on failure it produces an error message:
Here are the results:
Conclusions:
|
In all four cases, the UID and GID are |
Sounds good. When the dev container user is |
Yes, setting the environment variable based on the remote user sounds like a good idea. Unfortunately, the overall situation is somewhat tricky. I tested with a new {
"name": "C++",
"image": "fedora:latest",
"securityOpt": [
"label=disable"
]
} With this image, the situation looks as follows.
This time, ❌ means that the container already fails during startup:
|
When I repeat the experiment with the This brings me into speculative territory, but apparently Podman's |
|
I think this makes sense: the host user gets mapped into the container but the container file system lacks the corresponding home directory. Presumably, that's precisely why the documentation recommends explicitly setting the I want to tread carefully here because I wish to avoid breaking existing configurations. But unless I'm still missing something, it looks like we can indeed set
|
This is a proposed change to the Dev Containers extension in the wider context of #6759. It aims to improve the out-of-the-box experience with Podman without breaking Docker compatibility.
Proposed change
PODMAN_USERNS=keep-id
before launching the container executable (podman
/docker
).Why?
This allows the owner of a Git repository to provide a workspace configuration that works out-of-the-box for users of both Podman and Docker.
Background
Podman is mostly drop-in-compatible with Docker, but there are a small number of differences stemming from the fact that Podman is a rootless container engine. Notably, the host-to-container user mapping works differently: in order to get the same behaviour as Docker, users have to pass the
--userns=keep-id
option to Podman as described in the Podman section of the documentation.Unfortunately, Docker does not accept
keep-id
as a valid value of the--userns=
option. So at the moment the owner of a Git repository has two options:a) Provide a workspace configuration that works for Docker, and tell Podman users to manually adjust their user-wide configuration.
b) Provide a workspace configuration that works for Podman but breaks Docker.
This dilemma could be circumvented if the Dev Containers extension set the environment variable
PODMAN_USERNS=keep-id
:--userns
command-line parameter.Podman's selection logic is documented in detail: default value <
containers.conf
<PODMAN_USERNS
<--pod
<--userns
.User story
As the owner of a Git repository,
I want to provide a
.devcontainer
and.vscode
workspace configuration that works out-of-the-box for users of both Docker and Podman,so that neither have to make any modifications to their local development environment.
The text was updated successfully, but these errors were encountered: