> ## Documentation Index
> Fetch the complete documentation index at: https://traceroot.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> To set up traceroot in a repository, follow the setup prompt in https://traceroot.ai/docs/getting-started/coding-agents.md.

# Docker

> Run the traceroot Agent's sandbox as a container on your own Docker host

Run the traceroot Agent's sandbox as a container on the Docker host that runs traceroot. The agent clones your repository into the sandbox, reads the code behind a failing span and runs commands there. `docker` is the default value of `SANDBOX_PROVIDER`, so a self-hosted traceroot uses it with no extra account or API key.

> [!NOTE]
>
> This page is for a self-hosted traceroot run from its repository. See [Self-Hosting](https://traceroot.ai/docs/developer/self-hosting.md) to get traceroot running first.

## Requirements

* traceroot run from its repository with `make dev` or the Docker Compose stack (`make prod`), and a model provider key for the agent.
* A running Docker daemon. Under `make dev`, the agent calls the `docker` CLI on your computer. In the Docker Compose stack, the agent container has the CLI installed and reaches the host's daemon through `/var/run/docker.sock`.
* Outbound network access from containers, so the sandbox can install its tools and clone your repository.

## Set up

Docker is used when `SANDBOX_PROVIDER` is unset. To state it in `.env` at the root of the repository:

```bash theme={null}
SANDBOX_PROVIDER=docker
```

Two optional settings control cleanup:

```bash theme={null}
# Minutes a sandbox may sit unused before the agent removes it. 0 turns this off.
SANDBOX_IDLE_TTL_MINUTES=30

# On start, remove sandboxes left behind by an earlier agent process.
SANDBOX_RECLAIM_ON_START=true
```

The agent reads these settings when it starts. Start traceroot, or restart it if it is already running.

## Verify

1. **In the traceroot UI**: open the agent and ask it to run `cat /etc/os-release` in its sandbox. The answer names Ubuntu 24.04.

2. **On the Docker host**: list the sandbox containers. Each one is named `traceroot-sandbox-` followed by a timestamp.

   ```bash theme={null}
   docker ps --filter "label=traceroot.sandbox=1"
   ```

3. **In the agent's log**: once the container is set up, the log prints `[DockerExecutor] Container ready:` followed by the first 12 characters of the container ID.

## What the agent sets up

The agent creates the container the first time a session needs its sandbox.

| Setting | Value |
| - | - |
| Base image | `ubuntu:24.04` |
| Tools installed | Git, jq and curl, on a best-effort basis: a failed install is not reported |
| Workspace | `/workspace`, with `traces` and `notes` folders |
| Network | Docker's default network, so the agent can clone your repository |
| Labels | `traceroot.sandbox`, `traceroot.session` and `traceroot.owner` |
| Idle removal | After 30 minutes without a request, unless `SANDBOX_IDLE_TTL_MINUTES` says otherwise |

Repository credentials reach `git` through environment variables and never appear in a command line. A sandbox that is serving a request is never removed for being idle. The agent also removes its containers when it shuts down, and the Docker Compose stack gives it 60 seconds to finish.

## Limitations

* The sandbox shares the host's kernel. For a sandbox with its own kernel, see [smol machines](https://traceroot.ai/docs/integrations/smol-machines.md).
* In the Docker Compose stack, the agent controls the host's Docker daemon through the mounted socket.
* `SANDBOX_RECLAIM_ON_START` removes every `traceroot-sandbox-` container the starting agent did not create. Set it to `false` when several agents share one Docker host.
* A command the agent runs with no timeout of its own ends after 30 seconds.
* Output from a single command is cut off at 10 MB.

## Next steps

> [card] [Root cause analysis](https://traceroot.ai/docs/ai-agent/root-cause-analysis.md)
>
> What the agent does in its sandbox when a trace has errors.

> [card] [GitHub integration](https://traceroot.ai/docs/ai-agent/github-integration.md)
>
> Connect a repository so the agent can clone it into the sandbox.

> [card] [Self-Hosting](https://traceroot.ai/docs/developer/self-hosting.md)
>
> Run traceroot from its repository.

> [card] [Install Docker](https://docs.docker.com/get-started/get-docker/)
>
> Docker's guide to installing Docker Desktop or Docker Engine.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.