# Grok Build in Docker

> Run Grok Build in a container: EnvHaven's open-source image with Grok Build 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 Grok Build 1.0.70 in EnvHaven v1.9.0_

A container keeps whatever Grok Build 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 Grok Build and tap **Sign in**: it runs `grok login --device-auth` for you in the terminal. For an API key, choose **Set key** instead and paste `XAI_API_KEY`; the workspace keeps it write-only.
3. Start it with one tap: signed in, Grok Build gets a green dot in the Launch menu and an icon in the workspace's top bar. Support is built in (1.0.70), so there is nothing to install or update.
4. Give it a task. The image launches `grok` with `--always-approve`.

## The EnvHaven image, on your own Docker

The workspace image is MIT-licensed and ships Grok Build 1.0.70 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 `grok` 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 Grok Build has to keep

Grok Build keeps its settings in `~/.grok` ([source](https://docs.x.ai/build/settings/reference)). `grok login` caches the sign-in in `~/.grok/auth.json`.

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

## Full access inside the container

For one session:

```bash
grok --always-approve
```

As the default, in ~/.grok/config.toml:

```toml
[ui]
permission_mode = "always-approve"
```

`--always-approve` auto-approves every tool execution; in a session, Ctrl+O or Shift+Tab toggles it. Deny rules and hooks still apply, plans are still reviewed, and the setting is ignored in a project's own `.grok/config.toml`.

## Keep reading

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

Source: https://envhaven.com/agents/grok-build/docker
