Run T3 Code with Docker
run.sh serves T3 Code on http://127.0.0.1:3773 with
the current directory mounted at /workspace. airgapped.run.sh
does the same from a saved image on a host that cannot pull.
- Images
- GHCR
ghcr.io/hambn/t3code - Docker Hub
docker.io/hambn/t3code
- GHCR
- Use case
- Local GUI over a checkout
On this page
Prerequisites
- Docker Engine 23 or later.
Run T3 Code
./run.shThe server prints a Token: line when it is ready. 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 printed pairing URL
uses the container's IP address, which the host may not reach. Press Ctrl-C to stop
the server; the container, T3 Code's state, and the agent logins are removed with it.
The token expires after five minutes. To pair later, run
docker exec <container> t3 auth pairing create --base-url http://127.0.0.1:3773
with the container ID from docker ps, and open the Pair URL it prints.
To let agents run Docker commands, set T3CODE_DOCKER_SOCKET to the host socket.
run.sh mounts it at /var/run/docker.sock and adds its group:
T3CODE_DOCKER_SOCKET=/var/run/docker.sock ./run.shAccess to the socket gives the container root on the host.
Run without registry access
On a machine that can pull, save the image:
docker save ghcr.io/hambn/t3code:ubuntu-browser -o t3code.tarCopy the tar to the offline host and pass its path:
./airgapped.run.sh t3code.tarThe script loads the tar and runs T3CODE_IMAGE with --pull=never. It does not
support T3CODE_DOCKER_SOCKET.
Variables
| Variable | Required | Purpose |
|---|---|---|
T3CODE_IMAGE |
no | Image both scripts run. Defaults to ghcr.io/hambn/t3code:ubuntu-browser; set ghcr.io/hambn/t3code@sha256:<digest> to pin one build. |
T3CODE_DOCKER_SOCKET |
no | Host Docker socket for run.sh to mount at /var/run/docker.sock. |
Workspace
The current directory is mounted at /workspace. T3 Code and its agents run as
sysadmin (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
run.shpulls the image if needed and serves T3 Code on port 3773.airgapped.run.shloads a saved tar and runs it without pulling.
File contents
airgapped.run.sh18 lines
#!/usr/bin/env bash
# Offline host: load the image from a tar saved on an online host, never pull.
# docker save ghcr.io/hambn/t3code:ubuntu-browser -o t3code.tar
set -euo pipefail
image=${T3CODE_IMAGE:-ghcr.io/hambn/t3code:ubuntu-browser}
tar=${1:-t3code.tar}
shift $(($# > 0 ? 1 : 0))
[[ -f "$tar" ]] || {
echo "missing $tar; docker save it on an online host first" >&2
exit 1
}
docker load -i "$tar"
docker run -it --rm --pull=never \
-p 127.0.0.1:3773:3773 \
-v "$PWD:/workspace" \
"$image" "$@"run.sh22 lines
#!/usr/bin/env bash
# Run the T3 Code web GUI on http://127.0.0.1:3773 against the current directory.
set -euo pipefail
image=${T3CODE_IMAGE:-ghcr.io/hambn/t3code:ubuntu-browser}
docker_options=()
if [[ -n "${T3CODE_DOCKER_SOCKET:-}" ]]; then
[[ -S "$T3CODE_DOCKER_SOCKET" ]] || {
echo "not a Docker socket: $T3CODE_DOCKER_SOCKET" >&2
exit 1
}
docker_options+=(
--volume "$T3CODE_DOCKER_SOCKET:/var/run/docker.sock"
--group-add "$(stat -c %g "$T3CODE_DOCKER_SOCKET")"
)
fi
docker run -it --rm \
"${docker_options[@]}" \
-p 127.0.0.1:3773:3773 \
-v "$PWD:/workspace" \
"$image" "$@"