devcontainers / devcontainers/features

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

Offen
#193 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
enhancement
Vorherrschende Sprache
Shell
Sterne
1.5k
Forks
622
Ø Merge
6 T. 53 Min.
Gemergte PRs (30 T.)
9

Beschreibung

#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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne damit, die Feature-Definitionen von docker-from-docker und docker-in-docker sowie die Konfigurationsoptionen von devcontainer zu lesen. Verfolge, wie der Docker-Socket ausgewählt wird, und überprüfe anschließend, dass beide Features gemeinsam mit einem konfigurierbaren Ziel-Socket wie /var/run/docker-host-proxy.sock installiert werden können, während der aktuelle Standard unverändert bleibt.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
docker, shell
Bereich
devops
Issue-Typ
Feature
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.