Skip to content

feat: add docker-on-docker support - #1187

Merged
viceice merged 2 commits into
containerbase:mainfrom
felipecrs:docker-on-docker
Oct 9, 2026
Merged

viceice merged 2 commits into
containerbase:mainfrom
felipecrs:docker-on-docker

Conversation

@felipecrs

@felipecrs felipecrs commented Mar 26, 2026 •

Copy link
Copy Markdown
Contributor

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.

@viceice viceice left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this work on all platforms: windows (wsl), macos and linux?

@felipecrs

Copy link
Copy Markdown
Contributor Author

Works in Linux and WSL. Never tried on Mac, but now that I have one, I'll try it.

@viceice
viceice enabled auto-merge (squash) October 9, 2026 10:52
@viceice
viceice merged commit 772344e into containerbase:main Oct 9, 2026
4 checks passed
@felipecrs
felipecrs deleted the docker-on-docker branch October 11, 2026 18:46
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.

2 participants