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

# Run the browser on a Linux server

> Run otti-browser with Google Chrome in a Docker container on a Linux server, sign it in once, and use its tabs from any device.

The browser image runs `otti-browser` with Google Chrome on a virtual display, in a Docker container on a Linux server. Agents use it like the [browser on your Mac](https://docs.octomerge.dev/get-started/browser.md), with the sign-ins you give it. Nobody sees its screen: you see and use a tab with **Take over remotely**, from any device ([Remote takeover](https://docs.octomerge.dev/get-started/browser.md#remote-takeover)). Its sign-in, Chrome's profiles and their site sign-ins live on a volume, so they survive restarts and new images.

The image is `ghcr.io/octomergehq/otti-browser`, for **linux/amd64** (x86-64 servers). It holds `otti-browser` of one version of Octomerge's CLIs and Google Chrome stable, and comes in these tags:

| Tag | |
| - | - |
| `ghcr.io/octomergehq/otti-browser:latest` | Octomerge's current release with the newest Chrome. The examples use it. |
| `ghcr.io/octomergehq/otti-browser:<version>` | The newest Chrome for that version. When Google releases a new Chrome stable, Octomerge publishes the image with it within a day, under this tag and, for the current release, under `latest`. |
| `ghcr.io/octomergehq/otti-browser:<version>-chrome<chrome version>` | One image with one Chrome, such as `…-chrome158.0.8127.36`, which never changes. |

> [!NOTE]
>
> The image moved to a new name. Earlier images are `ghcr.io/ricsam/otti-browser`: they stay available, but their tags get no newer Chrome, and newer versions are published only under the new name. To update a browser set up with the earlier name, change the image's name along with its tag ([Updates](#updates)).

`otti-browser` updates itself from the image's version to your environment's ([Updates](#updates)). To stay on one version, use its tag instead of `latest`: **Settings → Browser** shows your environment's in its install command, `@octomerge/otti-browser@<version>`.

A browser holds the sign-ins of the sites you use in it, and agents act there with them: run it only on a server you trust, administered by people you trust.

## Before you start

* Docker 20.10 or newer, on a Linux kernel that lets unprivileged users create user namespaces (most distributions do).
* About 2 GB of memory and 2 CPUs for Chrome with a few tabs.
* Chrome's seccomp profile, which the container must run with ([Chrome's sandbox](#chrome’s-sandbox)). It is in the image:

```bash theme={null}
docker run --rm --entrypoint cat ghcr.io/octomergehq/otti-browser:latest \
  /usr/local/share/r5d-browser/chrome-seccomp.json > chrome-seccomp.json
```

## Sign it in

Create the volume and sign it in once, in a container that ends when the sign-in is done. **Settings → Browser** shows the sign-in command, `otti-browser auth` with your environment's `--base-url` and a one-time `--pair` token; run it in the image with the volume:

```bash theme={null}
docker volume create my-browser-home
docker run --rm -it -v my-browser-home:/home/r5d ghcr.io/octomergehq/otti-browser:latest \
  otti-browser auth --base-url https://octomerge.dev --pair <token>
```

Then approve it on the page that showed the command: pick the code your terminal shows ([Approving on the page](https://docs.octomerge.dev/cli/otti.md#approving-on-the-page)). The sign-in asks for **Browser** access, which lets the machine connect a browser and nothing else. It is saved on the volume (`~/.config/r5d`).

## Start it

```bash theme={null}
docker run -d --name my-browser --hostname my-browser \
  --restart unless-stopped --stop-timeout 60 \
  --security-opt seccomp=chrome-seccomp.json \
  --security-opt no-new-privileges --cap-drop ALL \
  --shm-size 2g --memory 4g --cpus 2 \
  -e OTTI_BASE_URL=https://octomerge.dev \
  -v my-browser-home:/home/r5d \
  ghcr.io/octomergehq/otti-browser:latest
```

`docker logs -f my-browser` shows its log, which says `Connected to https://octomerge.dev`, and **Settings → Browser** shows the browser connected, on Linux. What the options do:

* `--security-opt seccomp=chrome-seccomp.json`, `--security-opt no-new-privileges` and `--cap-drop ALL` are required: they keep Chrome's sandbox on with no other privilege ([Chrome's sandbox](#chrome’s-sandbox)).
* `--hostname`: Chrome's profile names the machine it runs on. Give every container of this volume the same name; a container with another one stops and says that the profile is locked by another machine.
* `--shm-size 2g`: Docker gives a container 64 MB of shared memory, too little for Chrome's pages.
* `--stop-timeout 60`: on a stop, the client finishes the browser action it is doing and closes Chrome, so its profile stays consistent; that usually takes under a second.

The container reads its settings from its environment:

| Variable | |
| - | - |
| `OTTI_BASE_URL` | Your environment's address, such as `https://octomerge.dev`. Required. |
| `OTTI_BROWSER_AUTO_UPDATE` | `0` keeps the image's `otti-browser`; `1` updates it. Unset: the choice saved on the volume, else on. |
| `OTTI_BROWSER_SCREEN` | The virtual display's size, `1600x1000x24` by default. Chrome's windows open 1050 pixels wide on it, as on a laptop's screen. |

Images of earlier releases read these settings as `R5D_BASE_URL`, `R5D_BROWSER_AUTO_UPDATE` and `R5D_BROWSER_SCREEN`, and a container of one keeps working: its otti-browser updates itself and connects to the server its volume's sign-in is for. One that gives its credential as `R5D_TOKEN` or `R5D_API_KEY` instead of a saved sign-in stops signing in once it updates: move it to a newer image, with `OTTI_TOKEN` or `OTTI_API_KEY`. Newer images read only the `OTTI_` names: rename the settings when you change its image.

`docker restart my-browser`, or `docker stop` then `docker start`, keeps everything, and so does a new container of the same or a newer image on the same volume:

```bash theme={null}
docker stop my-browser && docker rm my-browser
docker pull ghcr.io/octomergehq/otti-browser:latest
docker run -d --name my-browser --hostname my-browser … ghcr.io/octomergehq/otti-browser:latest   # the same options as above
```

**One container per volume.** Never run two containers on the same volume at once: stop the old one before you start the new one. Octomerge refuses a second connection of the same browser while the first is connected.

## Docker Compose

```yaml compose.yaml theme={null}
name: my-browser

services:
  browser:
    image: ghcr.io/octomergehq/otti-browser:latest
    hostname: my-browser
    restart: unless-stopped
    stop_grace_period: 60s
    security_opt:
      - seccomp=./chrome-seccomp.json
      - no-new-privileges:true
    cap_drop:
      - ALL
    shm_size: 2gb
    mem_limit: 4g
    cpus: 2
    environment:
      OTTI_BASE_URL: https://octomerge.dev
    volumes:
      - home:/home/r5d

volumes:
  home: {}
```

Keep `chrome-seccomp.json` beside the file. Sign the volume in once with `docker compose run --rm --no-deps browser otti-browser auth --base-url https://octomerge.dev --pair <token>`, then `docker compose up -d`, and `docker compose logs -f browser` for its log. `docker compose pull` and `docker compose up -d` bring a newer Chrome; in a file with the earlier image name, `ghcr.io/ricsam/otti-browser`, change the name first ([Updates](#updates)). `docker compose down -v` deletes the volume, and with it the browser's sign-in and every site's sign-in in Chrome.

## Using it

Agents open, read and use tabs there as in any browser: screenshots, clicks and typing, downloads and uploads, [isolated sessions](https://docs.octomerge.dev/get-started/browser.md#isolated-sessions), port forwards and [secret fills](https://docs.octomerge.dev/get-started/browser.md#filling-in-secrets) all work. What differs from a Mac:

* **Tab links offer Take over remotely only.** There is no screen to bring a tab to the front on, so **Bring to front** isn't offered. A takeover passes your keyboard shortcuts as a Linux machine takes them: on a Mac, **Command** works as Control there.
* **Sign in to sites in a takeover.** Open a tab link, take the tab over and sign in, from your computer or your phone. The sign-ins stay in the volume's Chrome profile.
* **Chrome's own windows can't be answered.** A passkey prompt or an HTTP sign-in that Chrome asks for itself appears on the server's virtual display, where nobody can answer it: cancel the passkey prompt in the takeover and sign in another way, or reload the page.

## Chrome's sandbox

Chrome keeps its sandbox on in the container: the image never starts it with `--no-sandbox`, which would let a compromised page reach everything the browser can, your sign-ins included. Chrome's sandbox runs each page in user, PID and network namespaces of its own, and Docker's default seccomp profile refuses to create them, so Chrome would not start.

`chrome-seccomp.json` is Docker's own default profile with three rules added, each with a comment: `clone` and `unshare` may create user, PID and network namespaces (mount, cgroup, UTS and IPC namespaces stay refused), and `chroot` is allowed, which Chrome's sandbox does inside its own namespace. The cost: processes in the container may create unprivileged user namespaces, which Docker's default refuses, the same kernel features any Linux desktop running Chrome uses. The container runs as an unprivileged user (uid 1000) with no capabilities and no setuid files, and Docker's AppArmor profile stays on.

Without the profile, Chrome stops at its start, and the log says to run the container with it.

## Updates

**otti-browser** updates itself when your environment selects a new release: it downloads the release into the volume and restarts its own process, and Chrome stays open. `OTTI_BROWSER_AUTO_UPDATE=0` keeps the image's version. A container of a newer image starts that image's version.

**Chrome** doesn't update in a running container: it stays the version the image installed. When Google releases a newer Chrome stable, the log says so, once for each newer version:

```text theme={null}
[otti-browser] Chrome 158.0.8127.36 is older than the newest Google Chrome stable, 159.0.8150.12, and misses its security fixes. …
```

Octomerge publishes the image with the new Chrome within a day, under your version's tag and, for the current release, under `latest`. Pull the tag again and start a new container on the same volume, as above; the sign-ins and the browser's state stay.

**A browser set up with the earlier image name**, `ghcr.io/ricsam/otti-browser`, keeps running and updating `otti-browser`, but its tags get no newer Chrome and no newer versions: those are published only as `ghcr.io/octomergehq/otti-browser`. Start its new container from the new name with the same volume and the same options: `docker stop my-browser && docker rm my-browser`, then the `docker run` of [Start it](#start-it) with `ghcr.io/octomergehq/otti-browser:latest`; with Compose, set `image: ghcr.io/octomergehq/otti-browser:latest` in `compose.yaml` and run `docker compose up -d`. The sign-ins and the browser's state stay.

## Stopping and removing it

`docker stop my-browser` finishes the current browser action, closes Chrome and exits; the log says `Disconnected and closed Chrome.` A container killed outright (`docker kill`, the out-of-memory killer) leaves Chrome's profile lock behind: the next start on the volume, with the same `--hostname`, removes it and starts Chrome.

To remove the browser: `docker stop my-browser && docker rm my-browser`, then `docker volume rm my-browser-home`, which deletes its sign-in, Chrome's profiles and every site's sign-in in them. Its entry in **Settings → Browser** stays, disconnected.

## When it can't sign in: exit code 78

Without a sign-in on the volume, the container says how to sign in and stops with exit code **78**, and so does a start whose sign-in Octomerge refuses, for example one you revoked under **Settings → CLI & API → Authorized devices** (a browser that is running when you revoke it keeps running, retries every 15 seconds and says so in its log). With `--restart unless-stopped`, Docker starts a stopped one again and again (`docker ps` shows `Restarting (78)`), and each start's log says why. Stop it with `docker update --restart=no my-browser` and `docker stop my-browser`, sign the volume in again as in [Sign it in](#sign-it-in), then `docker start my-browser`.


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