How to make cloud to pick up my Dockerfile?

I pushed an environment.json


{
 "build": {
 "dockerfile": "Dockerfile",
 "context": ".."
},
"install": "bash .cursor/cloud-agent-install.sh",
"start": "bash .cursor/cloud-agent-start.sh",
"terminals": [
 {
  "name": "Convex",
  "command": "pnpm exec convex dev"
 },
 {
  "name": "App",
  "command": "pnpm dev",
  "ports": [
    3000
   ]
  }
 ]
}

cloud detects environment. but I only have 1 button - start agent setup. And when I click it - the agent is able to set up the env, but it does not do anything with Docker at all. I want to use node24 image, but agent detects it is 22 and then goes circles installing v24 via nvm instead of using the Docker image. How it should work? I dont understand how to use docker setup at all. Please help

Hey, thanks for the request. Two different environment setup modes got mixed up here, and that’s why it’s confusing.

There are two mutually exclusive options:

  1. Interactive snapshot
    This is the Set up agent or Start agent setup button. Cursor starts a base Ubuntu image with Node 22, then the agent installs dependencies interactively, which is why it uses nvm to get to 24. After that it offers to save a snapshot. This mode completely ignores build.dockerfile, so it looks like nothing happens with Docker.

  2. Dockerfile mode
    For this one, you don’t need to click Set up agent. Just commit .cursor/environment.json with your build block plus .cursor/Dockerfile, then start a normal cloud agent on this repo and branch. The image will be built from the Dockerfile automatically.

What to double check in your config:

  • File location. Paths in build are resolved relative to .cursor. So "dockerfile": "Dockerfile" means .cursor/Dockerfile, the file must physically be there. "context": ".." points to the repo root, that’s fine.
  • Your Dockerfile must install git and ideally sudo. Cloud Agent runs git clone inside the container, and a custom image without git fails with a clone error. Add something like RUN apt-get update && apt-get install -y git sudo.
  • Don’t COPY the project into the image. Cursor will fetch the right commit itself.
  • If you previously saved a snapshot for this repo in Dashboard > Environments, it overrides the Dockerfile and keeps restoring. Delete the saved environment to force a fresh Dockerfile build.

More details on both modes: Cloud Environment Setup | Cursor Docs

Let me know how it goes after deleting the snapshot and confirming git is installed in the image.