Skip to content

feat: add docker-on-docker support#1187

Open
felipecrs wants to merge 1 commit intocontainerbase:mainfrom
felipecrs:docker-on-docker
Open

feat: add docker-on-docker support#1187
felipecrs wants to merge 1 commit intocontainerbase:mainfrom
felipecrs:docker-on-docker

Conversation

@felipecrs
Copy link

@felipecrs felipecrs commented Mar 26, 2026

This enables running docker commands (like docker build) inside the devcontainer itself.

For that to work, fixdockergid is now installed in the image and runs automatically on container start, which ensures the docker group inside the container has the same GID as the host's docker group, allowing seamless access to the docker socket.

To help test this, I added a devcontainer definition to this repository itself. Try reopening it in the devcontainer and running docker build . from the terminal. It should work without any permission issues.

Besides --use-api-socket (which replaces the good old -v /var/run/docker.sock:/var/run/docker.sock with perks), I also recommend running the devcontainer with --network=host so that it can access other services running as containers, like Redis (for Renovate).

After/if this PR is merged, I'll update the devcontainer definition of Renovate as well to leverage it.

Disclaimer: fixdockergid is my own open source project which I've been using and maintaining for several years.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant