Files
wehub-resource-sync 05fcd08057
Deploy GitBook to 9router.github.io / build-deploy (push) Failing after 2s
chore: import upstream snapshot with attribution
2026-07-13 12:21:01 +08:00

3.0 KiB

Docker

Run 9Router in a container. Published image: decolua/9router — multi-platform linux/amd64 + linux/arm64.


👤 For Users

Quick start

docker run -d \
  -p 20128:20128 \
  -v "$HOME/.9router:/app/data" \
  -e DATA_DIR=/app/data \
  --name 9router \
  decolua/9router:latest

App listens on port 20128. Open: http://localhost:20128

Manage container

docker logs -f 9router        # view logs
docker stop 9router           # stop
docker start 9router          # start again
docker rm -f 9router          # remove

Data persistence

-v "$HOME/.9router:/app/data" \
-e DATA_DIR=/app/data

Without DATA_DIR, the app falls back to ~/.9router/ (macOS/Linux) or %APPDATA%\9router\ (Windows). In the container, DATA_DIR=/app/data makes the bind mount work.

Data layout under $DATA_DIR/:

$DATA_DIR/
├── db/
│   ├── data.sqlite       # main SQLite database
│   └── backups/          # auto backups
└── ...                   # certs, logs, runtime configs

Host path: $HOME/.9router/db/data.sqlite Container path: /app/data/db/data.sqlite

Optional env vars

docker run -d \
  -p 20128:20128 \
  -v "$HOME/.9router:/app/data" \
  -e DATA_DIR=/app/data \
  -e PORT=20128 \
  -e HOSTNAME=0.0.0.0 \
  -e DEBUG=true \
  --name 9router \
  decolua/9router:latest

Optional Headroom sidecar

The 9Router image does not bundle Python or Headroom. To use Headroom in Docker, run it as a separate service and point 9Router at that proxy:

services:
  9router:
    image: decolua/9router:latest
    ports:
      - "20128:20128"
    volumes:
      - "$HOME/.9router:/app/data"
    environment:
      DATA_DIR: /app/data
      HEADROOM_URL: http://headroom:8787
    depends_on:
      - headroom

  headroom:
    image: ghcr.io/chopratejas/headroom:latest
    ports:
      - "8787:8787"

In the dashboard, open EndpointToken SaverHeadroom, confirm the URL is http://headroom:8787, recheck status, then enable Headroom.

If Headroom runs on the Docker host instead of as a sidecar, use http://host.docker.internal:8787 on macOS/Windows. On Linux, add --add-host=host.docker.internal:host-gateway or the equivalent compose extra_hosts entry.

Update to latest

docker pull decolua/9router:latest
docker rm -f 9router
# re-run the quick start command

🛠 For Developers

Build image locally (test)

cd app && docker build -t 9router .

docker run --rm -p 20128:20128 \
  -v "$HOME/.9router:/app/data" \
  -e DATA_DIR=/app/data \
  9router

Publish (automatic via CI)

Push a git tag v* → GitHub Actions builds multi-platform (amd64+arm64) and pushes to:

  • ghcr.io/decolua/9router:v{version} + :latest
  • decolua/9router:v{version} + :latest
# Use scripts/release.js (recommended)
node scripts/release.js "Release title" "Notes"

# Or manually
git tag v0.4.x && git push origin v0.4.x

Workflow: app/.github/workflows/docker-publish.yml