devcontainers / devcontainers/features

`docker-from-docker`: allow installation alongside `docker-in-docker`, as non-default docker configuration

Aperta
#193 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
enhancement
Lingua principale
Shell
Stelle
1.5k
Fork
621
Merge medio
6g 53m
PR unite (30g)
9

Descrizione

#171 prevents me from using `docker-from-docker` as the primary docker configuration for my devcontainer (since I need to share docker ports with internal processes). I realized, however, that there was nothing preventing me from mounting _both_ sockets and switching off between them. This allowed me to get what I really wanted out of `docker-from-docker`, which was the ability to update the devcontainer image on the host machine. This is useful for two reasons, both pertaining specifically to locally-running devcontainers:

1. I can use the devcontainer CLI to iterate on builds without shutting down the active dev container -- so if I'm making changes, I don't need to lose access to my project while I wait to see the there are any errors.
2. I can implement a "check for updates" process, where I use the host's docker daemon to check for the newest built version of the devcontainer image, download it, and then encourage the user to Rebuild Container at their earliest convenience _if and only if_ the image has actually changed since the one they're currently using. My image is privately hosted and I can't access my private registry from the bootstrap container (because doing so would require access to the host's credential helpers), so this is the only way to ensure that users start a Rebuild with an up-to-date cache.

I'm accomplishing this right now by vendoring some pieces of the `docker-from-docker` feature into a custom feature, but it seems like it would make more sense as a toggle for the existing feature: let me use my devcontainer configuration to set the target socket to e.g. `/var/run/docker-host-proxy.sock` instead of `/var/run/docker.sock`. Then I can use `DOCKER_HOST=/var/run/docker-host-proxy.sock` from scripts inside my devcontainer to interact specifically with the host's Docker daemon.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia leggendo le definizioni delle feature docker-from-docker e docker-in-docker e le opzioni di configurazione di devcontainer. Traccia come viene selezionato il socket Docker, quindi verifica che entrambe le feature possano essere installate insieme con un socket di destinazione configurabile come /var/run/docker-host-proxy.sock, mantenendo invariato il valore predefinito attuale.

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

Valutazione

Stack tecnologico
docker, shell
Ambito
devops
Tipo di issue
Funzionalità
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.