# Dev containers

URL: https://shellz.dev/docs/install/dev-containers

> Record terminals opened in development containers, for people and for coding agents.

Development containers are where coding agents often get a shell. With shellz in the dev container's image, every terminal opened in it is recorded, whether a person opened it in VS Code or an agent started it.

## 1. Create a fleet and save the token

[Create a fleet](https://shellz.dev/docs/install/container-image.md#1-create-a-fleet) with the platform **Dev container**. Save the token on your machine:

```bash
mkdir -p ~/.config/shellz
printf '%s' 'szf_<fleet token>' > ~/.config/shellz/fleet-token
```

## 2. Add shellz to the dev container's Dockerfile

```dockerfile title=".devcontainer/Dockerfile"
FROM mcr.microsoft.com/devcontainers/base:ubuntu
RUN curl -fsSL https://get.shellz.dev/container | sh
ENTRYPOINT ["/usr/local/bin/shellz", "run", "--"]
CMD ["sleep", "infinity"]
```

## 3. Update devcontainer.json

```json title=".devcontainer/devcontainer.json"
{
  "build": { "dockerfile": "Dockerfile" },
  "overrideCommand": false,
  "mounts": [
    "source=${localEnv:HOME}/.config/shellz/fleet-token,target=/run/secrets/shellz-fleet-token,type=bind,readonly"
  ],
  "runArgs": ["--stop-timeout", "30"],
  "containerEnv": { "SHELLZ_FLEET_PLATFORM": "devcontainer" }
}
```

- `overrideCommand: false` keeps the image's shellz entrypoint. Without it, the dev container tooling replaces the command and shellz never starts.
- The token is bind-mounted read-only from your machine instead of being set as an environment variable, which every terminal could read.
- `--stop-timeout 30` lets shellz finish uploading when the container stops.

Rebuild the container. Each new VS Code terminal is a recorded session.

## What's recorded

- Terminals opened in the editor, and shells started by coding agents through the editor's terminal.
- `docker exec` into the dev container from your machine.

The editor's own background processes (language servers, extensions, file watchers) aren't sessions and aren't recorded.

> [!NOTE]
> A [Docker host](https://shellz.dev/docs/install/docker-host.md) install on the machine running your dev containers records `docker exec` into them, but not editor terminals: those are started by the editor's server inside the container. To record editor terminals, use the in-image install on this page.
