2026-04-09 14:21:30 +07:00
# Docker
2026-05-13 18:22:31 +07:00
Run 9Router in a container. Published image: [`decolua/9router` ](https://hub.docker.com/r/decolua/9router ) — multi-platform `linux/amd64` + `linux/arm64` .
2026-04-09 14:21:30 +07:00
2026-05-13 18:22:31 +07:00
---
2026-04-09 14:21:30 +07:00
2026-05-13 18:22:31 +07:00
# 👤 For Users
2026-04-09 14:21:30 +07:00
2026-05-13 18:22:31 +07:00
## Quick start
2026-04-09 14:21:30 +07:00
```bash
docker run -d \
-p 20128:20128 \
-v " $HOME /.9router:/app/data" \
2026-04-10 10:14:34 +07:00
-e DATA_DIR = /app/data \
2026-04-09 14:21:30 +07:00
--name 9router \
2026-05-13 18:22:31 +07:00
decolua/9router:latest
2026-04-09 14:21:30 +07:00
```
2026-05-13 18:22:31 +07:00
App listens on port `20128` . Open: http://localhost:20128
## Manage container
2026-04-09 14:21:30 +07:00
```bash
2026-05-13 18:22:31 +07:00
docker logs -f 9router # view logs
docker stop 9router # stop
docker start 9router # start again
docker rm -f 9router # remove
2026-04-09 14:21:30 +07:00
```
2026-05-13 18:22:31 +07:00
## Data persistence
2026-04-09 14:21:30 +07:00
```bash
2026-05-13 18:22:31 +07:00
-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 \
2026-04-09 14:21:30 +07:00
-p 20128:20128 \
-v " $HOME /.9router:/app/data" \
2026-04-10 10:14:34 +07:00
-e DATA_DIR = /app/data \
2026-04-09 14:21:30 +07:00
-e PORT = 20128 \
-e HOSTNAME = 0.0.0.0 \
-e DEBUG = true \
--name 9router \
2026-05-13 18:22:31 +07:00
decolua/9router:latest
```
## Update to latest
```bash
docker pull decolua/9router:latest
docker rm -f 9router
# re-run the quick start command
```
---
# 🛠 For Developers
2026-05-13 18:25:29 +07:00
## Build image locally (test)
2026-05-13 18:22:31 +07:00
```bash
cd app && docker build -t 9router .
docker run --rm -p 20128:20128 \
-v " $HOME /.9router:/app/data" \
-e DATA_DIR = /app/data \
2026-04-09 14:21:30 +07:00
9router
```
2026-05-13 18:25:29 +07:00
## Publish (automatic via CI)
2026-05-13 18:22:31 +07:00
2026-05-13 18:25:29 +07:00
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`
2026-04-09 14:21:30 +07:00
```bash
2026-05-13 18:25:29 +07:00
# Use scripts/release.js (recommended)
node scripts/release.js "Release title" "Notes"
2026-05-13 18:22:31 +07:00
2026-05-13 18:25:29 +07:00
# Or manually
git tag v0.4.x && git push origin v0.4.x
2026-04-09 14:21:30 +07:00
```
2026-05-13 18:25:29 +07:00
Workflow: `app/.github/workflows/docker-publish.yml`