# Docker Run 9Router in a container. Published image: [`decolua/9router`](https://hub.docker.com/r/decolua/9router) — multi-platform `linux/amd64` + `linux/arm64`. --- # 👤 For Users ## Quick start ```bash 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 ```bash docker logs -f 9router # view logs docker stop 9router # stop docker start 9router # start again docker rm -f 9router # remove ``` ## Data persistence ```bash -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/`: ```text $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 ```bash 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 ``` ## Update to latest ```bash docker pull decolua/9router:latest docker rm -f 9router # re-run the quick start command ``` --- # 🛠 For Developers ## Build image locally ```bash # from repo root npm run docker:build ``` Or directly: ```bash cd app && docker build -t 9router . ``` Run local build: ```bash docker run --rm -p 20128:20128 \ -v "$HOME/.9router:/app/data" \ -e DATA_DIR=/app/data \ 9router ``` ## Publish to Docker Hub (multi-platform) Triggered automatically by `npm run cli:publish`. Manual: ```bash # 1. Login once docker login # 2. Build amd64 + arm64 + push (tag from app/cli/package.json version) npm run docker:publish ``` Tags pushed: - `decolua/9router:v{version}` - `decolua/9router:latest`