Background Agent Docker in Docker

Here is a complete working example of Docker-in-Docker (DinD) working with Cursor cloud/background agents.

I used some of the ideas above, but also needed some hacks to properly restart docker, and to let docker run as a non-root user. Some of the hacks seem like quirks of the current Cursor cloud agent environment, so hopefully will become quickly outdated as Cursor make DinD a first class experience.

To use: Fork the repo, then start a new cloud agent and tell it to run docker ps

5 Likes

Would be really nice if there was proper support for this. In comparison, GitHub Copilot coding agent, since it’s just a regular GitHub action/workflow, has all options that ci provides, like running docker containers to allow the agent to test the changes it’s making.

It’s really nice to have community support actually find a way, but for critical code bases, it’s not acceptable to rely on multiple untrusted dependencies in an environment that has an agent running with internet access :confused:

I must therefore stick to copilot for now, unfortunately :smiley: