You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/docker.md
+99Lines changed: 99 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -149,6 +149,105 @@ volumes:
149
149
150
150
The `shm_size` and `seccomp` settings are needed for Chromium to run properly in a container.
151
151
152
+
### External Browser
153
+
154
+
Run `chromedp/headless-shell` as a separate container and point Spacebot at it via
155
+
`connect_url`. This decouples the browser lifecycle from the main process and avoids
156
+
bundling Chromium into the Spacebot image.
157
+
158
+
Workers spawned by the same agent share one Chrome process (each gets its own tab). A
159
+
Chrome crash kills all tabs for that agent.
160
+
161
+
#### Spacebot on host, browser in Docker
162
+
163
+
When Spacebot runs as a binary directly on the host, expose port 9222 so the host process
164
+
can reach the container:
165
+
166
+
```yaml
167
+
# docker-compose.yml
168
+
services:
169
+
browser:
170
+
image: chromedp/headless-shell:latest
171
+
container_name: browser
172
+
ports:
173
+
- "127.0.0.1:9222:9222"
174
+
shm_size: 1gb
175
+
restart: unless-stopped
176
+
```
177
+
178
+
Test whether the browser is reachable from the host:
179
+
180
+
```bash
181
+
curl http://localhost:9222/json/version
182
+
```
183
+
184
+
Then configure Spacebot via config:
185
+
186
+
```toml
187
+
[defaults.browser]
188
+
connect_url = "http://localhost:9222"
189
+
```
190
+
191
+
#### Per-agent dedicated sandboxes
192
+
193
+
Use a `config.toml` to route each agent to its own container:
194
+
195
+
```toml
196
+
[defaults.browser]
197
+
connect_url = "http://browser-main:9222"
198
+
199
+
[[agents]]
200
+
id = "research"
201
+
[agents.browser]
202
+
connect_url = "http://browser-research:9222"
203
+
204
+
[[agents]]
205
+
id = "internal"
206
+
[agents.browser]
207
+
enabled = false
208
+
```
209
+
210
+
```yaml
211
+
services:
212
+
spacebot:
213
+
image: ghcr.io/spacedriveapp/spacebot:slim
214
+
volumes:
215
+
- spacebot-data:/data
216
+
- ./config.toml:/data/config.toml:ro
217
+
networks:
218
+
- spacebot-net
219
+
220
+
browser-main:
221
+
image: chromedp/headless-shell:latest
222
+
networks:
223
+
- spacebot-net
224
+
shm_size: 512mb
225
+
restart: unless-stopped
226
+
227
+
browser-research:
228
+
image: chromedp/headless-shell:latest
229
+
networks:
230
+
- spacebot-net
231
+
shm_size: 1gb
232
+
restart: unless-stopped
233
+
234
+
networks:
235
+
spacebot-net:
236
+
237
+
volumes:
238
+
spacebot-data:
239
+
```
240
+
241
+
#### `connect_url`
242
+
243
+
Accepted formats:
244
+
- `http://host:9222`— auto-discovers the WebSocket URL via `/json/version` (preferred)
245
+
- `ws://host:9222/devtools/browser/<id>`— direct WebSocket URL
246
+
247
+
An empty string is treated as unset and falls back to the embedded launch path.
248
+
249
+
If the browser container crashes or the WebSocket drops, the next browser operation returns a clear `"external browser connection lost"` error rather than an opaque protocol failure.
0 commit comments