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

Aperta
#1,284 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
58/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
cli, devops

Direzione di ricerca

Inizia tracciando dove la Dev Containers CLI inserisce l’argomento semplice --userns=keep-id e come risolve il remoteUser all’interno dell’immagine. Verifica gli argomenti Podman generati per un UID/GID dell’host elevato e per ID dell’host e del container corrispondenti, assicurandoti che in entrambi i casi vengano mantenuti i permessi previsti del workspace.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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 like1400601154, 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=<remote-uid>,gid=<remote-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.

Lingua principale
TypeScript
Stelle
3k
Fork
461
Merge medio
13h 17m
PR unite (30g)
6

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di devcontainers/cli

Tutte le issue di devcontainers/cli

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.