devcontainers / devcontainers/features

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

Open
#193 2 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Shell
Stars
1.5k
Forks
621
Avg merge
2d 11h
Merged PRs (30d)
4

Description

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.