You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Kudos to the team for the Dev Containers extension 🚀. It's a great project, and we look forward to collaborating to improve Podman users' UX.
For this reason, I am trying to find a solution to avoid having to explicitly set $HOME in a .vscode/devcontainer.json to successfully start a Dev Container with Podman (this workaround is mentioned in the documentation).
Currently, if a user doesn't set $HOME in the devcontainer.json, the container startup fails because the extension tries to create a folder in /root instead of $HOME:
Open the command palette and select Dev Containers: Open Folder in Container
Analyzing the failure
This is what I could infer from the Dev Containers log and may not be 100% accurate but those are the steps that preceded the error:
The container is started and, as a user is not specified, the default (root) is used
The extension inspects the container and reads the Config.Env["HOME"] to infer $HOME:
when it's Podman HOME=/root
when it's Docker HOME is not set
The extension runs a podman/docker exec command, as user vscode, to create the folder $HOME/.vscode-server/bin`
when it's Podman the flag --env=HOME=/root is passed to the exec command
when it's Docker the flag --env=HOME=/home/vscode is passed to the exec command
Podman sets HOME=/root when starting the container. But this is intended: when $HOME is unset, Podman sets it based on/etc/passwd. This is a valuable feature as many command line tools expect $HOME to be set.
Proposals to address the problem
Avoid inspecting the $HOME environment variable, of a container started as an arbitrary user (often this means root), to infer the $HOME variable to use with user vscode.
VSCode Version: 1.96.4
Local OS Version: macOS 15.3
Remote OS Version: Fedora 41
Remote Extension/Connection Type: Dev Containers
The text was updated successfully, but these errors were encountered:
Hi Mario, thanks for investigating! To avoid breaking existing devcontainers we could check if the user has write access on $HOME and ignore the variable if not.
@chrmarti thank you for looking at this 🙌. Sure, this should be fine too!
Another option would be to figure out if you are talking with Podman (using the ping API for example) and avoid inferring $HOME by inspecting when it's the case. It may be overkill for this particular issue, but it would help in the future if you want to provide better Podman support.
Hi 👋, I am Mario, and I am a Podman maintainer.
Kudos to the team for the Dev Containers extension 🚀. It's a great project, and we look forward to collaborating to improve Podman users' UX.
For this reason, I am trying to find a solution to avoid having to explicitly set
$HOME
in a.vscode/devcontainer.json
to successfully start a Dev Container with Podman (this workaround is mentioned in the documentation).Currently, if a user doesn't set
$HOME
in the devcontainer.json, the container startup fails because the extension tries to create a folder in/root
instead of$HOME
:Steps to Reproduce:
Dev Containers: Open Folder in Container
Analyzing the failure
This is what I could infer from the Dev Containers log and may not be 100% accurate but those are the steps that preceded the error:
root
) is usedHOME=/root
HOME
is not setpodman/docker exec
command, as uservscode
, to create the folder $HOME/.vscode-server/bin`--env=HOME=/root
is passed to theexec
command--env=HOME=/home/vscode
is passed to theexec
commandPodman sets
HOME=/root
when starting the container. But this is intended: when$HOME
is unset, Podman sets it based on/etc/passwd
. This is a valuable feature as many command line tools expect$HOME
to be set.Proposals to address the problem
Avoid inspecting the
$HOME
environment variable, of a container started as an arbitrary user (often this meansroot
), to infer the$HOME
variable to use with uservscode
.The text was updated successfully, but these errors were encountered: