Skip to content

Commit b8ab868

Browse files
authored
Merge pull request docker#24932 from dvdksn/sbx/cursor
sbx/cursor
2 parents 239ebeb + 4ac6ead commit b8ab868

9 files changed

Lines changed: 161 additions & 15 deletions

File tree

content/manuals/ai/sandboxes/agents/_index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Supported agents
33
linkTitle: Agents
44
weight: 30
55
description: AI coding agents supported by Docker Sandboxes.
6-
keywords: docker sandboxes, ai agents, claude code, codex, gemini
6+
keywords: docker sandboxes, ai agents, claude code, codex, cursor, gemini
77
---
88

99
{{< summary-bar feature_name="Docker Sandboxes sbx" >}}
@@ -13,6 +13,7 @@ Docker Sandboxes runs the following agents out of the box:
1313
- [Claude Code](claude-code/)
1414
- [Codex](codex/)
1515
- [Copilot](copilot/)
16+
- [Cursor](cursor/)
1617
- [Droid](droid/)
1718
- [Gemini](gemini/)
1819
- [Kiro](kiro/)
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
---
2+
title: Cursor
3+
weight: 33
4+
description: |
5+
Use Cursor in Docker Sandboxes with API key or proxy-managed OAuth
6+
authentication.
7+
keywords: docker sandboxes, cursor, cursor agent, ai agent, sbx
8+
---
9+
10+
{{< summary-bar feature_name="Docker Sandboxes sbx" >}}
11+
12+
This guide covers authentication, configuration, and usage of Cursor in a
13+
sandboxed environment.
14+
15+
Official documentation: [Cursor CLI](https://cursor.com/cli)
16+
17+
## Quick start
18+
19+
Create a sandbox and run Cursor for a project directory:
20+
21+
```console
22+
$ sbx run cursor ~/my-project
23+
```
24+
25+
The workspace parameter is optional and defaults to the current directory:
26+
27+
```console
28+
$ cd ~/my-project
29+
$ sbx run cursor
30+
```
31+
32+
## Authentication
33+
34+
Cursor supports two authentication methods: an API key or OAuth.
35+
36+
**API key**: Store your Cursor API key using
37+
[stored secrets](../security/credentials.md#stored-secrets):
38+
39+
```console
40+
$ sbx secret set -g cursor
41+
```
42+
43+
Alternatively, export the `CURSOR_API_KEY` environment variable in your shell
44+
before running the sandbox. See
45+
[Credentials](../security/credentials.md) for details on both methods.
46+
47+
**OAuth**: If no API key is set, Cursor prompts you to sign in interactively
48+
on first run. The proxy intercepts the token exchange with
49+
`api2.cursor.sh/auth/poll`, so credentials are managed by the host and aren't
50+
stored inside the sandbox.
51+
52+
## Configuration
53+
54+
Sandboxes don't pick up user-level configuration from your host, such as
55+
`~/.cursor`. Only project-level configuration in the working directory is
56+
available inside the sandbox. See
57+
[Why doesn't the sandbox use my user-level agent configuration?](../faq.md#why-doesnt-the-sandbox-use-my-user-level-agent-configuration)
58+
for workarounds.
59+
60+
Cursor reads `AGENTS.md` from the workspace for agent-specific instructions.
61+
62+
The sandbox runs Cursor in YOLO mode by default, which executes commands
63+
without approval prompts. Pass additional `cursor-agent` CLI options after
64+
`--`:
65+
66+
```console
67+
$ sbx run cursor --name <sandbox-name> -- <cursor-options>
68+
```
69+
70+
## Base image
71+
72+
Template: `docker/sandbox-templates:cursor-agent-docker`
73+
74+
Preconfigured to run in YOLO mode with HTTP/1.1 and server-sent events for
75+
agent traffic so requests flow through the host proxy. Authentication state
76+
is persisted across sandbox restarts.
77+
78+
See [Customize](../customize/) to pre-install tools or customize this
79+
environment.

content/manuals/ai/sandboxes/customize/kits.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -577,8 +577,9 @@ When a kit doesn't behave as expected, start with the network policy log
577577
and direct inspection inside the sandbox:
578578

579579
- `sbx policy log` shows every outbound request the sandbox proxy saw,
580-
the rule it matched, and how it was forwarded (`forward-bypass`,
581-
`forward`, `block`). Use it to diagnose install-time download failures,
580+
the rule it matched, extra context when available, and its `PROXY`
581+
value, such as `forward`, `forward-bypass`, `transparent`, or
582+
`browser-open`. Use it to diagnose install-time download failures,
582583
blocked domains, and unexpected TLS interception. If downloads fail or
583584
arrive corrupted after you add `serviceDomains`, check whether the
584585
service mapping is too broad. Map only the hosts that need credential

content/manuals/ai/sandboxes/customize/templates.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ CLI, and common development tools like Node.js, Python, Go, and Java.
4444
| `claude-code-minimal` | Claude Code with a minimal toolset (no Node.js, Python, Go, or Java) |
4545
| `codex` | [OpenAI Codex](https://github.com/openai/codex) |
4646
| `copilot` | [GitHub Copilot](https://github.com/github/copilot-cli) |
47+
| `cursor-agent` | [Cursor](https://cursor.com/cli) |
4748
| `docker-agent` | [Docker Agent](https://github.com/docker/docker-agent) |
4849
| `droid` | [Droid](https://www.factory.ai) |
4950
| `gemini` | [Gemini CLI](https://github.com/google-gemini/gemini-cli) |

content/manuals/ai/sandboxes/security/policy.md

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -166,22 +166,28 @@ Use `sbx policy log` to see which hosts your sandboxes have contacted:
166166
```console
167167
$ sbx policy log
168168
Blocked requests:
169-
SANDBOX TYPE HOST PROXY RULE LAST SEEN COUNT
170-
my-sandbox network blocked.example.com transparent policykit 10:15:25 29-Jan 1
169+
SANDBOX TYPE HOST PROXY RULE REASON LAST SEEN COUNT
170+
my-sandbox network blocked.example.com transparent domain-blocked default-deny 10:15:25 29-Jan 1
171171

172172
Allowed requests:
173-
SANDBOX TYPE HOST PROXY RULE LAST SEEN COUNT
174-
my-sandbox network api.anthropic.com forward policykit 10:15:23 29-Jan 42
175-
my-sandbox network registry.npmjs.org transparent policykit 10:15:20 29-Jan 18
173+
SANDBOX TYPE HOST PROXY RULE REASON LAST SEEN COUNT
174+
my-sandbox network api.anthropic.com forward domain-allowed 10:15:23 29-Jan 42
175+
my-sandbox network registry.npmjs.org forward-bypass domain-allowed 10:15:20 29-Jan 18
176+
my-sandbox network app.example.com browser-open 10:15:10 29-Jan 1
176177
```
177178

178179
The **PROXY** column shows how the request left the sandbox:
179180

180-
| Value | Description |
181-
| ------------- | -------------------------------------------------------------------------------------------------------------- |
182-
| `forward` | Routed through the forward proxy. Supports [credential injection](credentials.md). |
183-
| `transparent` | Intercepted by the transparent proxy. Policy is enforced but credential injection is not available. |
184-
| `network` | Non-HTTP traffic (raw TCP, UDP, ICMP). TCP can be allowed with a policy rule; UDP and ICMP are always blocked. |
181+
| Value | Description |
182+
| ---------------- | -------------------------------------------------------------------------------------------------------------- |
183+
| `forward` | Routed through the forward proxy. Supports [credential injection](credentials.md). |
184+
| `forward-bypass` | Routed through the forward proxy without credential injection. |
185+
| `transparent` | Intercepted by the transparent proxy. Policy is enforced but credential injection is not available. |
186+
| `network` | Non-HTTP traffic (raw TCP, UDP, ICMP). TCP can be allowed with a policy rule; UDP and ICMP are always blocked. |
187+
| `browser-open` | A sandbox process requested opening a URL in the host browser. Policy is enforced before opening the URL. |
188+
189+
The **RULE** column identifies the policy rule that matched the request. The
190+
**REASON** column includes extra context when the daemon records one.
185191

186192
Filter by sandbox name by passing it as an argument:
187193

data/sbx_cli/sbx_create.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ see_also:
5757
- sbx create claude - Create a sandbox for claude
5858
- sbx create codex - Create a sandbox for codex
5959
- sbx create copilot - Create a sandbox for copilot
60+
- sbx create cursor - Create a sandbox for cursor
6061
- sbx create docker-agent - Create a sandbox for docker-agent
6162
- sbx create droid - Create a sandbox for droid
6263
- sbx create gemini - Create a sandbox for gemini
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: sbx create cursor
2+
synopsis: Create a sandbox for cursor
3+
description: |-
4+
Create a sandbox with access to a host workspace for cursor.
5+
6+
The workspace path is required and will be mounted inside the sandbox at the
7+
same path as on the host. Additional workspaces can be provided as extra
8+
arguments. Append ":ro" to mount them read-only.
9+
10+
Use "sbx run SANDBOX" to attach to the agent after creation.
11+
usage: sbx create cursor PATH [PATH...] [flags]
12+
options:
13+
- name: help
14+
shorthand: h
15+
default_value: "false"
16+
usage: help for cursor
17+
inherited_options:
18+
- name: branch
19+
usage: Create a Git worktree on the given branch
20+
- name: cpus
21+
default_value: "0"
22+
usage: |
23+
Number of CPUs to allocate to the sandbox (0 = auto: N-1 host CPUs, min 1)
24+
- name: debug
25+
shorthand: D
26+
default_value: "false"
27+
usage: Enable debug logging
28+
- name: kit
29+
default_value: '[]'
30+
usage: |
31+
Kit reference (directory, ZIP, or OCI). Can be specified multiple times
32+
- name: memory
33+
shorthand: m
34+
usage: |
35+
Memory limit in binary units (e.g., 1024m, 8g). Default: 50% of host memory, max 32 GiB
36+
- name: name
37+
usage: |
38+
Name for the sandbox (default: <agent>-<workdir>, letters, numbers, hyphens, periods, plus signs and minus signs only)
39+
- name: quiet
40+
shorthand: q
41+
default_value: "false"
42+
usage: Suppress verbose output
43+
- name: template
44+
shorthand: t
45+
usage: |
46+
Container image to use for the sandbox (default: agent-specific image)
47+
example: |4-
48+
# Create in the current directory
49+
sbx create cursor .
50+
51+
# Create with a specific path
52+
sbx create cursor /path/to/project
53+
54+
# Create with additional read-only workspaces
55+
sbx create cursor . /path/to/docs:ro
56+
see_also:
57+
- sbx create - Create a sandbox for an agent

data/sbx_cli/sbx_run.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ description: |-
88
99
To create a sandbox without attaching, use "sbx create" instead.
1010
11-
Available agents: claude, codex, copilot, docker-agent, droid, gemini, kiro, opencode, shell
11+
Available agents: claude, codex, copilot, cursor, docker-agent, droid, gemini, kiro, opencode, shell
1212
usage: sbx run [flags] SANDBOX | AGENT [PATH...] [-- AGENT_ARGS...]
1313
options:
1414
- name: branch

data/sbx_cli/sbx_secret_set.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ synopsis: Create or update a secret
33
description: |-
44
Create or update a secret for a service.
55
6-
Available services: anthropic, aws, droid, github, google, groq, mistral, nebius, openai, xai
6+
Available services: anthropic, aws, cursor, droid, github, google, groq, mistral, nebius, openai, xai
77
88
When no arguments are provided, an interactive prompt guides you through
99
scope and service selection.

0 commit comments

Comments
 (0)