File size: 2,195 Bytes
88c4c60 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | # 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 (test)
```bash
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`
```bash
# 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`
|