Cloud agents with docker-compose

I can’t install docker currently in my cloud agent, which is not allowing me to run my docker compose that is needed to setup mysql, and my php server.

I kept getting errors like so:

```
Err:4 http://security.ubuntu.com/ubuntu noble-security InRelease Connection failed [IP: 91.189.92.23 80]
```

Docker isn’t pre-installed in cloud agents by default. To use Docker (and Docker Compose), you’ll need to set up a custom environment using .cursor/Dockerfile and .cursor/environment.json in your repo.

The docs walk through the full setup here: Running Docker (Cloud Agent Setup)

In short:

  1. Create a .cursor/Dockerfile that installs Docker CE, Docker Compose, fuse-overlayfs, and iptables-legacy (the docs have a recommended Dockerfile you can expand and copy)

  2. Create a .cursor/environment.json referencing that Dockerfile

  3. Add sudo service docker start to the start command in your environment.json so the Docker daemon is running when the agent starts

For a working example, check out this community repo: cursor-cloud-agent-dind

Once Docker is running, you can start your MySQL and PHP containers via docker compose up either in the start command or by letting the agent run it during its task.

I just saw the announcement about “agent-led environment setup”. Does that new agent driven setup work with docker compose based setups?

Yes, the agent-driven setup can handle docker-compose-based environments. When you go through the setup flow, Cursor inspects your repos and figures out which tools and dependencies are needed. If your project uses docker-compose, it should detect and configure Docker accordingly.

A couple of things to keep in mind:

  • Make sure to provide any required environment variables and secrets (database credentials, API keys, etc.) during the setup flow so your containers can start properly

  • Docker in cloud agents runs inside another container layer, so complex setups may still benefit from a custom Dockerfile configuration with fuse-overlayfs and iptables-legacy

  • Add sudo service docker start to your start command so the Docker daemon is running when the agent begins its work

The Running Docker section of the docs has a recommended Dockerfile for more complex Docker setups if you run into edge cases.