devcontainers / devcontainers/cli

Podman fix: derive `--userns=keep-id` mapping from the remote user's actual UID/GID

Đang mở
#1,284 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
TypeScript
Star
3k
Fork
457
Merge trung bình
13 giờ 17 phút
Pull request đã merge (30 ngày)
6

Mô tả

## The problem

When running a dev container with rootless podman, the Dev Containers CLI injects a plain `--userns=keep-id` flag, which maps the host user id to the *same UID number* inside the container.

This breaks for high/out-of-range host UIDs (e.g. AD/SSSD users which have values like`1400601154`, which are not valid inside the container (they are out of range as the containers are typically given a 0-65535 range via subuid/subgid mapping). As a result the mapping fails silently and the container's `vscode` user remains at UID 1000, not matching the host user, and causing `Permission denied` on the workspace bind mount).

## Current workaround

The current workaround is a fragile manual `runArgs` entry (`--userns=keep-id:uid=1000,gid=1000`). Since the host UID is unmappable to itself, we keep the 1000 id inside the container and map the host user to that. This allows one to use podman on Linux boxes with AD and thus high uid/gid combinations, as it removes the requirement for the exact host UID to be inside the container's range.

## The request for improvement

Instead of injecting a plain `--userns=keep-id`, the CLI should resolve the `remoteUser`'s actual UID/GID in the image and emit `--userns=keep-id:uid=,gid=`. This fixes the high-UID case with no regressions: when the host UID already equals the container user's UID, `keep-id:uid=X,gid=X` produces the identical mapping to plain `keep-id`, so existing setups are unaffected.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Start by tracing where the Dev Containers CLI injects the plain `--userns=keep-id` argument and how it resolves the `remoteUser` inside the image. Verify the generated Podman arguments for a high host UID/GID and for matching host and container IDs, with both cases preserving the expected workspace permissions.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
typescript
Lĩnh vực
cli, devops
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
58/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.