gotty-docker

agent
Guvenlik Denetimi
Gecti
Health Gecti
  • License — License: MIT
  • Description — Repository has a description
  • Active repo — Last push 0 days ago
  • Community trust — 19 GitHub stars
Code Gecti
  • Code scan — Scanned 12 files during light audit, no dangerous patterns found
Permissions Gecti
  • Permissions — No dangerous permissions requested

Bu listing icin henuz AI raporu yok.

SUMMARY

Hardened Ubuntu 26.04 + GoTTY v1.8.0 multi-arch Docker image with tmux coding-agent web cockpit presets (Tailscale / Cloudflare Tunnel) & security guide.

README.md

GoTTY Docker

CI
Publish Docker image
Docker image
Docker Pulls
GoTTY
Ubuntu
Platforms
License
PRs Welcome
Stars

GoTTY Docker social preview

Run a real Linux terminal — or a hardened Remote Coding Agent Web Cockpit (tmux + Claude Code / Codex / Copilot CLI) — in your browser with Docker. Built on Ubuntu 26.04 and the maintained GoTTY v1.8.0 fork, with Basic Auth helpers, zero-port Tailscale Serve / Cloudflare Tunnel presets, Compose examples, and multi-architecture publishing. (한국어 요약)

GoTTY Docker demo

Contents

Why

GoTTY turns any command-line program into
a web application, which is perfect for sharing a shell, a live log, or a TUI
dashboard without installing anything on the client. This image gives you a
batteries-included, authentication-first container so you can go from
docker run to a usable browser terminal in one command — instead of wiring up
GoTTY, a base image, TLS, and auth yourself every time.

Features

  • 🔐 Auth-first — Basic Auth via env vars, a credential string, or Docker secret files (safely handles files without trailing newlines or with CRLF endings); warns loudly if started open.
  • 🤖 Remote Coding Agent Web Cockpit — hardened Compose preset (docker-compose.agent-cockpit.yml) for persistent tmux sessions (Claude Code, Codex, Copilot CLI) exposed strictly via Tailscale Serve or Cloudflare Tunnel with zero open public TCP ports.
  • 🧱 Modern base — Ubuntu 26.04 + the maintained sorenisanerd/gotty v1.8.0, with the release tarball checksum-verified at build time.
  • 🏗️ Multi-arch — published for linux/amd64 and linux/arm64.
  • 🩺 Healthcheck built in — the container reports healthy on 200/401.
  • 📦 Compose-ready — runnable examples covering authenticated shells, read-only monitors, shared tmux, random URLs, TLS, and zero-port agent cockpits.
  • 🛠️ Configurable — sensible defaults you can override entirely through GOTTY_* environment variables.

What's New

  • Remote Coding Agent Web Cockpit preset (docker-compose.agent-cockpit.yml, .env.agent-cockpit.example, docs/AGENT-COCKPIT.md) with Tailscale Serve (AllowFunnel: false) and Cloudflare Tunnel profiles, persistent tmux, cap_drop: ALL, and zero published host ports.
  • Fixed run_gotty.sh secret-file reading when a Docker/Kubernetes secret lacks a trailing newline or uses CRLF, backed by shell regression tests (tests/test_run_gotty.sh).
  • Ubuntu base 26.04 + maintained sorenisanerd/gotty v1.8.0 with linux/amd64 and linux/arm64 publishing.
  • Basic Auth via GOTTY_USER + GOTTY_PASSWORD, GOTTY_CREDENTIAL, or Docker secret files.
  • Runnable examples for authenticated shell, read-only monitor, shared tmux, random URL, and TLS.

Quick Start

export GOTTY_PASSWORD="$(openssl rand -base64 24)"
echo "GoTTY password: ${GOTTY_PASSWORD}"

docker run --rm -it \
  -p 8989:8080 \
  -e GOTTY_USER=gotty \
  -e GOTTY_PASSWORD="${GOTTY_PASSWORD}" \
  modenaf360/gotty-docker:latest

Open http://localhost:8989 and sign in as gotty.

With Compose:

cp .env.example .env
$EDITOR .env
docker compose up --build

Remote Coding Agent Web Cockpit

Keep persistent tmux sessions running Claude Code, OpenAI Codex CLI, and GitHub Copilot CLI inside Docker, and reconnect from any browser or tablet with zero open public TCP ports:

cp .env.agent-cockpit.example .env.agent-cockpit
chmod 600 .env.agent-cockpit
$EDITOR .env.agent-cockpit

# Option A — Tailscale Serve (tailnet-only HTTPS, Funnel disabled)
docker compose --env-file .env.agent-cockpit \
  -f docker-compose.agent-cockpit.yml \
  --profile tailscale up -d

# Option B — Cloudflare Tunnel (route hostname to http://gotty:8080 + Cloudflare Access)
docker compose --env-file .env.agent-cockpit \
  -f docker-compose.agent-cockpit.yml \
  --profile cloudflare up -d

Hardening baked into docker-compose.agent-cockpit.yml:

  • No ports: published on the host — ingress passes strictly through Tailscale Serve (AllowFunnel: false, userspace mode) or cloudflared.
  • Fail-closed Basic Auth — GOTTY_USER=cockpit is set by default so run_gotty.sh exits 64 instead of opening an unprotected shell if GOTTY_PASSWORD is missing.
  • Least privilege — cap_drop: [ALL], no-new-privileges:true, pids_limit: 256, and init: true to reap agent child processes.
  • Persistent state — named volumes keep /workspace and /root intact across container restarts, and tmux new-session -A -s agent-cockpit survives browser disconnects.

Read docs/AGENT-COCKPIT.md for the multi-window tmux layout, Cloudflare Access setup, and a derived Dockerfile.cockpit template for preinstalling coding-agent CLIs.

Common Samples

All samples live in examples/ (plus the top-level Agent Cockpit preset) and run from the repository root.

Use case Command Port
Remote Coding Agent Web Cockpit (Tailscale / Cloudflare) docker compose --env-file .env.agent-cockpit -f docker-compose.agent-cockpit.yml --profile tailscale up -d none (tunnel only)
Authenticated writable shell GOTTY_PASSWORD=secret docker compose -f examples/basic-auth-shell.compose.yml up --build 8989
Read-only top dashboard docker compose -f examples/read-only-monitor.compose.yml up --build 8990
Shared tmux session GOTTY_PASSWORD=secret docker compose -f examples/tmux-shared-session.compose.yml up --build 8991
Random URL GOTTY_PASSWORD=secret docker compose -f examples/random-url.compose.yml up --build 8992
Self-signed TLS ./examples/make-self-signed-cert.sh && GOTTY_PASSWORD=secret docker compose -f examples/tls-self-signed.compose.yml up --build 8993

Behind a Reverse Proxy

For anything beyond localhost, terminating TLS at a reverse proxy is usually
cleaner than GoTTY's built-in TLS. GoTTY speaks WebSocket, so make sure the proxy
forwards Upgrade/Connection headers. Run the container with auth and bind it
to the loopback interface (for example -p 127.0.0.1:8989:8080), then point the
proxy at it.

Caddy
term.example.com {
    reverse_proxy 127.0.0.1:8989
}

Caddy handles HTTPS certificates and WebSocket upgrades automatically.

Nginx
server {
    listen 443 ssl;
    server_name term.example.com;

    # ssl_certificate / ssl_certificate_key ...

    location / {
        proxy_pass http://127.0.0.1:8989;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
        proxy_read_timeout 86400;
    }
}
Traefik (Compose labels)
labels:
  - "traefik.enable=true"
  - "traefik.http.routers.gotty.rule=Host(`term.example.com`)"
  - "traefik.http.routers.gotty.entrypoints=websecure"
  - "traefik.http.routers.gotty.tls.certresolver=le"
  - "traefik.http.services.gotty.loadbalancer.server.port=8080"

Configuration

Variable Default Description
GOTTY_USER unset Username used to build user:password Basic Auth credentials.
GOTTY_PASSWORD unset Password paired with GOTTY_USER.
GOTTY_CREDENTIAL unset Direct GoTTY credential string, for example alice:correct-horse-battery-staple. Takes precedence over GOTTY_USER and GOTTY_PASSWORD.
GOTTY_CREDENTIAL_FILE unset File containing a user:password credential, useful with Docker secrets (handles files without trailing newlines and CRLF).
GOTTY_PASSWORD_FILE unset File containing only the password for GOTTY_USER (handles files without trailing newlines and CRLF).
GOTTY_COMMAND /bin/bash -l Command GoTTY starts for each connection.
GOTTY_PERMIT_WRITE true Allows browser clients to type into the terminal. Set to false for dashboards.
GOTTY_RECONNECT true Enables browser reconnect behavior.
GOTTY_RANDOM_URL unset Set to true to generate a non-root URL path.
GOTTY_RANDOM_URL_LENGTH 8 Length of the random URL path segment when GOTTY_RANDOM_URL=true.
GOTTY_TLS unset Set to true to enable GoTTY TLS directly.
GOTTY_TITLE_FORMAT GoTTY Docker Browser tab/title text for the terminal.
GOTTY_ADDRESS 0.0.0.0 Interface GoTTY binds to inside the container.
GOTTY_PORT 8080 Port GoTTY listens on inside the container.

GoTTY also reads its own GOTTY_* environment variables, including GOTTY_MAX_CONNECTION, GOTTY_ONCE, GOTTY_TIMEOUT, GOTTY_TLS_CRT, and GOTTY_TLS_KEY.

Image Tags

Tag Description
modenaf360/gotty-docker:latest Latest build from master.
modenaf360/gotty-docker:v1.8.0-ubuntu26.04 Pinned to a specific GoTTY + Ubuntu combination. Prefer this for reproducible deployments.
modenaf360/gotty:latest, modenaf360/gotty:v1.8.0-ubuntu26.04 Legacy image name kept for backward compatibility with the original README.

All tags are multi-arch manifests covering linux/amd64 and linux/arm64, so
Docker pulls the right architecture automatically. For maximum reproducibility,
pin by digest (modenaf360/gotty-docker@sha256:...).

Security Notes

GoTTY exposes a terminal. Treat it like shell access.

  • Never publish a writable shell without authentication.
  • Basic Auth over plain HTTP is not encrypted. Use TLS, a reverse proxy, or the zero-port Remote Coding Agent Web Cockpit preset (Tailscale Serve or Cloudflare Tunnel + Cloudflare Access) when exposing GoTTY beyond localhost.
  • When using the Cloudflare Tunnel profile, always enforce a Cloudflare Access policy (SSO/MFA) in front of the hostname — never expose a bare tunnel without Access.
  • Prefer GOTTY_PERMIT_WRITE=false for monitoring views.
  • Use tmux for shared or long-running coding-agent sessions so reconnects attach to the same process.
  • Avoid mounting sensitive host paths or the Docker socket unless you explicitly want that level of control from the browser.

See SECURITY.md for the full hardening checklist and how to report a vulnerability.

Build

make build

This tags:

  • modenaf360/gotty-docker:latest
  • modenaf360/gotty-docker:v1.8.0-ubuntu26.04
  • modenaf360/gotty:latest
  • modenaf360/gotty:v1.8.0-ubuntu26.04

Publish

docker login
make push

make push publishes multi-architecture images for linux/amd64 and linux/arm64, including the legacy modenaf360/gotty alias used by the old README.

GitHub Actions can publish the same image on master, tags, or manual dispatch. Add these repository secrets first:

  • DOCKERHUB_USERNAME
  • DOCKERHUB_TOKEN

If those secrets are not configured, the workflow skips publishing instead of failing the build.

Troubleshooting

The browser shows "Authentication required" or a 401 loop

That is expected when Basic Auth is enabled — sign in with GOTTY_USER and
GOTTY_PASSWORD. The container's healthcheck also treats 401 as healthy, since
it proves GoTTY is up and protecting the terminal.

The terminal connects but immediately disconnects

This is almost always a reverse proxy that isn't forwarding WebSocket upgrade
headers. Make sure Upgrade and Connection: upgrade are passed through and that
read timeouts are long enough (see Behind a Reverse Proxy).

`GOTTY_PASSWORD` errors when running Compose

The Compose files require a password so you never start an open shell by accident:

export GOTTY_PASSWORD="$(openssl rand -base64 24)"
docker compose up --build
Multiple browsers each get their own shell

By default every connection spawns a fresh shell. Use the shared tmux example
so reconnects and additional clients attach to the same session.

`exec format error` after pulling the image

That indicates an architecture mismatch. The published tags are multi-arch
(amd64 + arm64); pull :latest without forcing --platform and Docker will
select the right one.

Assets

The README GIF and social preview are generated, not hand-edited:

uv run --python 3.12 --with pillow scripts/render_assets.py
# or with an existing Pillow install:
python3 scripts/render_assets.py

Use assets/social-preview.png as the GitHub repository social preview image.

Contributing

Issues and pull requests are welcome. Please read
CONTRIBUTING.md for the dev setup and the checks CI runs, and
be mindful of the Code of Conduct. If this image saved you
from wiring up a web terminal by hand, a ⭐ helps others find it.

References

한국어 요약

GoTTY Docker는 Ubuntu 26.04 + sorenisanerd/gotty v1.8.0 기반의 브라우저 웹 터미널 컨테이너입니다(linux/amd64, linux/arm64 지원).

  • Remote Coding Agent Web Cockpit (docker-compose.agent-cockpit.yml): Claude Code, Codex, Copilot CLI 같은 CLI 코딩 에이전트를 영구 tmux 세션(agent-cockpit)에 띄워 두고, 호스트 TCP 포트를 하나도 열지 않은 채 Tailscale Serve(--profile tailscale, Funnel 비활성화) 또는 Cloudflare Tunnel(--profile cloudflare)로만 안전하게 접속할 수 있습니다. 자세한 설정은 docs/AGENT-COCKPIT.md를 참고하세요.
  • 기존 GoTTY 빠른 실행: GOTTY_USER / GOTTY_PASSWORD 또는 Docker secret 파일(GOTTY_PASSWORD_FILE, GOTTY_CREDENTIAL_FILE — 개행 없는 시크릿 파일 및 CRLF 안전 처리)로 Basic Auth를 켜고 docker run 또는 docker compose up으로 바로 실행할 수 있습니다.
  • 보안 주의사항: 인증 없이 쓰기 가능한 셸을 외부에 공개하지 마세요. 로컬호스트 외부에서 접속할 때는 Tailscale Serve, Cloudflare Access를 붙인 Cloudflare Tunnel, 또는 HTTPS 리버스 프록시를 반드시 사용하세요.

License

MIT © hyeonsangjeon. Packages the MIT-licensed
GoTTY binary.

Yorumlar (0)

Sonuc bulunamadi