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"
  }
}
1 Like

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