---
title: "Docker Sandboxes kit"
description: "Run a disposable SurrealDB in a Docker Sandboxes microVM with the sbx kit. Covers requirements, ports, storage, credentials and the network allow-list."
canonical_url: "https://surrealdb.com/docs/running/docker-sandboxes"
section: "Running"
surrealdb_version: "4.x"
last_modified: "2026-11-24T04:11:20Z"
---

> Full SurrealDB documentation index: https://surrealdb.com/docs/llms.txt

# Docker Sandboxes kit

Run a disposable SurrealDB in a Docker Sandboxes microVM with the sbx kit. Covers requirements, ports, storage, credentials and the network allow-list.

[Docker Sandboxes](https://docs.docker.com/ai/sandboxes/) run each environment in its own microVM, with its own filesystem, network and Docker daemon. The SurrealDB kit, [`surrealdb/surrealdb-docker-sbx`](https://github.com/surrealdb/surrealdb-docker-sbx), starts one with SurrealDB already running and the `surreal` command-line tool on the `PATH`. Use it for a database you can fill, break and throw away, or hand to a coding agent, without any of that reaching your machine. To run the server from the official image instead, see [Docker](/docs/running/docker.md).

## Requirements

- The [`sbx`](https://docs.docker.com/ai/sandboxes/install/) command-line tool. On macOS, install it with `brew trust docker/tap && brew install docker/tap/sbx`.
- A Docker login, created with `sbx login`.

## Start the sandbox

```bash
sbx run git+https://github.com/surrealdb/surrealdb-docker-sbx.git
```

The first start installs SurrealDB inside the sandbox. Every start then launches the server in the background and waits until it accepts connections, so your shell opens only when the database is ready. The server listens on port 8000 inside the sandbox, and by default it keeps its data in memory.

To work on the kit itself, or to run it from disk, clone the repository and pass the folder to `sbx run`. A project directory placed after it is mounted into the sandbox:

```bash
git clone https://github.com/surrealdb/surrealdb-docker-sbx
sbx run ./surrealdb-docker-sbx ~/my-project
```

## Use the database

The sandbox sets `SURREAL_USER`, `SURREAL_PASS` and `SURREAL_ENDPOINT`, which the `surreal` tool reads, so its commands need no credential or endpoint flags. Inside the sandbox shell:

```bash
surreal sql --ns demo --db demo
```

The repository includes `examples/seed.surql`, a small schema of people, projects and `works_on` graph edges. Mount a clone of the repository into the sandbox, then import it from there:

```bash
surreal import --ns demo --db demo examples/seed.surql
```

To reach the database from the host, for example from your own application or from Studio, publish the port when you start the sandbox. `sbx ports` lists the ports that are currently published.

```bash
sbx run git+https://github.com/surrealdb/surrealdb-docker-sbx.git -p 8000:8000
```

> [!WARNING]
> The kit starts SurrealDB with the user `root` and the password `root`, reachable only from inside the microVM and from `127.0.0.1` on the host. It is a development environment, so do not put production or sensitive data in it.

## Configuration

Set each option as an environment variable with `sbx run -e KEY=VALUE`.

| Variable | Default | Purpose |
| --- | --- | --- |
| `SURREAL_STORAGE` | `memory` | The storage engine, `memory` or `rocksdb`. |
| `SURREAL_DATA_DIR` | `~/.surrealdb/data` | The folder the `rocksdb` option writes to. |
| `SURREAL_PATH` | unset | Any storage path the CLI accepts, such as `surrealkv:/path`. It overrides `SURREAL_STORAGE`. |
| `SURREAL_BIND` | `0.0.0.0:8000` | The address the server listens on inside the sandbox. |
| `SURREAL_USER`, `SURREAL_PASS` | `root`, `root` | The root user, created at the first start. |
| `SURREAL_ENDPOINT` | `http://127.0.0.1:8000` | The address the readiness check and your own scripts use. |

### Keep data between restarts

In-memory data disappears when the sandbox stops. To keep it across restarts of the same sandbox, choose an on-disk engine:

```bash
sbx run git+https://github.com/surrealdb/surrealdb-docker-sbx.git -e SURREAL_STORAGE=rocksdb
```

The data goes to `~/.surrealdb/data` on a 5 GB volume that the kit declares. The volume survives a restart but not `sbx rm`. In SurrealDB 4.0 the `rocksdb` option opens the files with SurrealKV and logs a deprecation warning. To select SurrealKV directly, set `SURREAL_PATH` to a `surrealkv:` path under `~/.surrealdb`.

## Network access

A sandbox denies outbound network access by default. The kit opens two domains and nothing else: `install.surrealdb.com` for the install script, and `download.surrealdb.com` for the binaries the script fetches.

## Next steps

- [Docker](/docs/running/docker.md) - run the official image directly
- [Installation](/docs/running/installation.md) - install SurrealDB on your own machine
- [`surreal db start`](/docs/reference/cli/db/commands/start.md) - every storage engine and server option
