Cloud Agent with Dockerfile

I have been trying to set up the Cloud Agent via Dockerfile, following the instructions in: Cloud Agents | Cursor Docs .

I’m having trouble configuring the start and install commands. When I set the install command, the Agent never starts. And the start command doesn’t do anything.

For instance, I’m setting up a Rails environment. I wanted to set the install command to run bundle install, and the start command should start redis and postgres, so that the agent can easily run the application’s tests.

Does anyone have experience with this and could point out to me what I am doing wrong? I found the documentation very lacking in examples.

Here’s my environment.json setup:

{
  "name": "Rails Agent v8",
  "install": "bundle install", // For some reason when this is here, the agent won't start, if not here it starts, but then the agent will need to run before doing anything
  "start": "sudo service postgresql start && sudo service redis-server start", // This have no effect, the agent still have to start manually
  "build": {
    "context": ".",
    "dockerfile": "Dockerfile"
  }
}
2 Likes

hi, sorry, right now debugging ability for docker environments is really limited, we are working on improving UX. will send you a DM

1 Like

I’ve experienced the same issue and solved by following.

  • Located both environment.json and Dockerfile under .cursor/
  • Installed sudo in Dockerfile
  • Grant execution permission to bin/ scripts (bundle, rails, setup, etc.)

Dockerfile sample:

FROM ruby:3.2.2

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update \
    && apt-get install -y --no-install-recommends \
       build-essential \
       ca-certificates \
       curl \
       git \
       gnupg \
       lsb-release \
       openssh-client \
       tzdata \
       sudo \
    && rm -rf /var/lib/apt/lists/*

RUN install -d /etc/apt/keyrings \
    && curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc \
       | gpg --dearmor -o /etc/apt/keyrings/postgresql.gpg \
    && echo "deb [signed-by=/etc/apt/keyrings/postgresql.gpg] https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" \
       > /etc/apt/sources.list.d/pgdg.list \
    && apt-get update \
    && apt-get install -y --no-install-recommends \
       postgresql-16 \
       postgresql-client-16 \
       postgresql-16-pgvector \
    && rm -rf /var/lib/apt/lists/*

RUN useradd -ms /bin/bash ubuntu
RUN echo 'ubuntu ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
USER ubuntu
WORKDIR /home/ubuntu

ENV PATH="/home/ubuntu/.local/bin:${PATH}"
1 Like

@nbradford Is there any update on using Dockerfiles for cloud agents?

hi - we’ve now exposed the docker build logs (and other information about the environment setup) in web and IDE. You should be able to see directly if the docker build has an error, and add logging to your install command to see if there are any issues there.

Separately, if you’re open to the Snapshot-based approach instead of Dockerfile, we are trialing a new setup workflow where the Cursor agent will configure the environment for you, which should be a lot smoother. If you’re interested in early access, just let me know

I get ‘Errored’ for the environment setup, docker build seems to complete.

I don’t see any errors in the last few lines of output (nor anywhere else I can see):slight_smile:

```
[Build] Status: #17 [stage-2 3/3] RUN groupadd --system --gid 1000 rails && useradd rails --uid 1000 --gid 1000 --create-home --shell /bin/bash && chown -R rails:rails db log storage tmp
DONE 1.9s
exporting to image
exporting layers
exporting layers 0.8s done
writing image sha256:8281d5ea68f86267d970d0dd40ee04e5c6ceba51712a89773b114fdadccc82da done
naming to Docker Hub Container Image Library | App Containerization done
DONE 0.8s
```

A second pane appears in the cloud agent pane above the chat box that just says ‘error’ but I can’t expand it