devcontainers / devcontainers/spec

UID/GID sync scripts

Aperta
#25 13 commenti 4 reazioni 0 assegnatari Vedi su GitHub
proposal
Lingua principale
Nessun dato sulla lingua
Stelle
5.7k
Fork
498
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

Using bind mounts on Linux (inclusive of WSL) can be confusing since the actual file descriptors from the host are used - inclusive of all permissions. The problem is that the user in the container - whether root or otherwise, can have different UID/GIDs than the host user - which means that files in the source folder can be unreadable or unwritable on either the host or the container depending on the situation. While you can use a volume to house source code instead of bind mounts, its useful to be able to use local source code mounts as well and can be manditory in CI/Automation scenarios as #9 is released.

The spec and reference CLI includes an `updateRemoteUserUID` property that defaults to `true` to deal with this problem which automatically updates a specified non-root user (in `containerUser` or `rootUser`).

However, while this does automatically update permissions in that user's `$HOME` directory in the container, it does not update other locations. This is problematic in a number of cases, but particularly when packages or other content the user needs to work with is not located there.

Generally, the needed update is a `chown -R` on a directory, but this is not always the case - and more subtle updates can often be better (e.g. using `find /location -uid 1000 -execdir chown username-here {} \+`). To provide a nuanced way to handle this, I'd propose a model similar to #19 where either Dockerfiles or dev container features can add a script to a known location. When a processor like the dev container CLI then executes a UID/GID update, these bash scripts are fired to make the needed updates. These would run as root and should be owned by root as a part of final image prep much like the `usermod`/`groupmod` commands when this step is needed.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia leggendo la specifica e il riferimento alla gestione della CLI per la proprietà updateRemoteUserUID, quindi confronta il modello di estensione proposto con l’issue #19. Definisci come vengono individuati e invocati gli script di proprietà di root forniti da Dockerfiles o dev container features e verifica il comportamento per la proprietà al di fuori della directory home dell’utente.

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

Valutazione

Stack tecnologico
bash, docker
Ambito
cli, devtools, infrastructure
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
32/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.