# Pi in Docker

> Run Pi in a container: EnvHaven's open-source image with Pi built in, a managed workspace with nothing to run, and the folders and keys a container of your own has to keep.

_Updated November 23, 2026 · Checked against Pi 0.87.1 in EnvHaven v1.9.0_

A container keeps whatever Pi does with full access away from your own files, which makes it the usual home for unattended runs. EnvHaven is built on that idea in two forms: a managed workspace, which is the container already running on a server of its own, and the open-source workspace image, which you run with Docker yourself.

## A managed workspace: nothing to run

1. Open your workspace in any browser. It is the EnvHaven container on its own always-on server, with an HTTPS address for what you build.
2. Tap **Launch**, choose Pi and tap **Sign in**: it starts Pi, which asks you to sign in the first time. For an API key, choose **Set key** instead and paste `ANTHROPIC_API_KEY`, `OPENAI_API_KEY` or `GEMINI_API_KEY`; the workspace keeps it write-only.
3. Start it with one tap: signed in, Pi gets a green dot in the Launch menu and an icon in the workspace's top bar. Support is built in (0.87.1), so there is nothing to install or update.
4. Give it a task. Runs unchanged; it never stops to ask.

## The EnvHaven image, on your own Docker

The workspace image is MIT-licensed and ships Pi 0.87.1 beside 16 other agents. Its home is `/config`, so one volume keeps every agent's settings and sign-in when the container is replaced:

```bash
docker run -d \
  --name envhaven \
  -p 8443:8443 \
  -p 2222:22 \
  -e PASSWORD=password \
  -e SUDO_PASSWORD=password \
  -v envhaven-config:/config \
  ghcr.io/envhaven/envhaven:latest
```

Open `http://localhost:8443`, run `pi` in the terminal and sign in. The [self-hosted guide](https://envhaven.com/guides/self-hosted-dev-environment) covers SSH and Haven CLI against it.

## What a container for Pi has to keep

Pi keeps its settings in `~/.pi/agent` ([source](https://docs.pi.dev/latest/configuration)). `/login` saves OAuth tokens and API keys to `auth.json` there, and `PI_CODING_AGENT_DIR` moves the folder.

In a container of your own, mount a volume there so a rebuilt container stays signed in, or pass `ANTHROPIC_API_KEY`, `OPENAI_API_KEY` or `GEMINI_API_KEY` as an environment variable instead of signing in.

## Full access inside the container

Load trusted project resources without the startup prompt:

```bash
pi --approve
```

Limit the tools it may use:

```bash
pi --tools read,grep,find,ls
```

Pi never asks before using a tool: it has no approval system to turn off. Its only prompt is project trust at startup, when a folder carries Pi settings, extensions or skills, which `--approve` (load them) or `--no-approve` (skip them) answers for one run.

## Keep reading

- [Pi](https://envhaven.com/agents/pi)
- [Pi in the browser](https://envhaven.com/agents/pi/browser)
- [Pi on iPhone](https://envhaven.com/agents/pi/iphone)
- [Pi on iPad](https://envhaven.com/agents/pi/ipad)
- [Pi on Android](https://envhaven.com/agents/pi/android)
- [Pi on a Chromebook](https://envhaven.com/agents/pi/chromebook)
- [Coding agents in Docker](https://envhaven.com/agents/docker)

Source: https://envhaven.com/agents/pi/docker
