tool-containers
Menu
GitHub (opens in new tab)

Run T3 Code with Docker Compose

The t3code service serves T3 Code on http://127.0.0.1:3773 with the directory in WORKSPACE mounted at /workspace. compose.sh checks that WORKSPACE is an absolute path, because Compose would resolve a relative one against this directory, then runs docker compose here.

Images
  • GHCRghcr.io/hambn/t3code
  • Docker Hubdocker.io/hambn/t3code
Use case
Persistent local instance
Upstream
github.com/pingdotgg/t3code (opens in new tab)
Source
tools/ai/t3code/docs/docker-compose (opens in new tab)
On this page

Prerequisites

  • Docker Engine with the Compose v2 plugin.

Run T3 Code

Shell
WORKSPACE="$PWD" ./compose.sh up -d
WORKSPACE="$PWD" ./compose.sh logs t3code | grep Token:

Open http://127.0.0.1:3773/pair#token=<token> to pair your browser, then add /workspace as a project and sign in to an agent from the UI. The token expires after five minutes; for a new pair URL, run:

Shell
WORKSPACE="$PWD" ./compose.sh exec t3code t3 auth pairing create --base-url http://127.0.0.1:3773

./compose.sh stop and ./compose.sh start keep the container, so T3 Code's state and the agent logins survive. Each start prints a new token. ./compose.sh down removes the container and that state. The service has no restart policy, so it does not start again after a host reboot until you run up or start.

Run without registry access

On a connected machine, run docker save ghcr.io/hambn/t3code:ubuntu-browser -o t3code.tar. On the offline host, load it and use the air-gapped file, which sets pull_policy: never:

Shell
docker load -i t3code.tar
WORKSPACE="$PWD" ./compose.sh -f airgapped.docker-compose.yml up -d

Variables

Variable Required Purpose
WORKSPACE yes Absolute host path mounted at /workspace.
T3CODE_IMAGE no Image for both Compose files. Defaults to ghcr.io/hambn/t3code:ubuntu-browser; set a digest reference to pin one build.

Workspace

WORKSPACE is mounted at /workspace. T3 Code runs as UID 1000, so new files belong to UID 1000 on the host. The port is bound to 127.0.0.1; put an authenticating reverse proxy in front before you expose it further.

Files

File contents

airgapped.docker-compose.yml12 lines
# Offline: docker load -i t3code.tar first, then
# WORKSPACE="$PWD" ./compose.sh -f airgapped.docker-compose.yml up -d
name: t3code

services:
  t3code:
    image: ${T3CODE_IMAGE:-ghcr.io/hambn/t3code:ubuntu-browser}
    pull_policy: never
    volumes:
      - ${WORKSPACE:?Set WORKSPACE to an absolute host path}:/workspace
    ports:
      - "127.0.0.1:3773:3773"
compose.sh18 lines
#!/usr/bin/env bash
# Compose resolves relative paths against this directory, so require an absolute WORKSPACE.
set -euo pipefail

case "${WORKSPACE:-}" in
/*) ;;
"")
    echo "Set WORKSPACE to an absolute host path." >&2
    exit 2
    ;;
*)
    echo "WORKSPACE must be an absolute host path: $WORKSPACE" >&2
    exit 2
    ;;
esac

cd -- "$(dirname -- "${BASH_SOURCE[0]}")"
exec docker compose "$@"
docker-compose.yml10 lines
# WORKSPACE="$PWD" ./compose.sh up -d
name: t3code

services:
  t3code:
    image: ${T3CODE_IMAGE:-ghcr.io/hambn/t3code:ubuntu-browser}
    volumes:
      - ${WORKSPACE:?Set WORKSPACE to an absolute host path}:/workspace
    ports:
      - "127.0.0.1:3773:3773"

Topics