kasuga77/luci-app-kiri
About
在 OpenWrt 软路由上运行 Kiri 容器引擎(Docker 兼容,可替代 Docker),带 LuCI 中文管理界面与一键在线升级 / Run the Kiri container engine on OpenWrt with a full LuCI UI and one-click upgrades
Systems & InfrastructureWhat you can do
- Engine service - kiri daemon supervised by procd: starts at boot, respawns on crash, no systemd needed
- Containers - List / start / stop / restart / remove / logs / create containers from a web form (image, name, ports, command, restart policy)
- Images - List and remove images, prune unused images, prune stopped containers
- Engine - Daemon state, start / stop / restart, engine info, storage usage, kiri doctor self-check
Measured star growth
- in 24h
- 0
- in 7 days
- Collecting history
- in 15 days
- Collecting history
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README.md
Originalluci-app-kiri
Run the Kiri container engine on an OpenWrt soft router, with a full LuCI management UI (containers / images / engine / one-click upgrade).
Kiri is a lightweight container runtime written in Rust that speaks the Docker Engine API. It starts containers two orders of magnitude faster than Docker Desktop and has a tiny memory footprint — a good fit for memory-constrained routers.
简体中文
在 OpenWrt 软路由 上运行 Kiri 容器引擎,并提供完整的 LuCI 中文管理界面(容器 / 镜像 / 引擎 / 一键在线升级)。
特性
| 模块 | 说明 |
|---|---|
| 引擎服务 | 用 procd 托管 kiri daemon,开机自启、崩溃自动拉起,不依赖 systemd |
| 容器管理 | 列表 / 启动 / 停止 / 重启 / 删除 / 查看日志 / 图形化创建容器(镜像、名称、端口、命令、重启策略) |
| 镜像管理 | 列表、删除、清理未使用镜像、清理已停止容器 |
| 引擎管理 | 运行状态、重启 / 停止 / 启动、引擎信息、存储占用、kiri doctor 自检 |
| 在线升级 | 一键检查新版本并从官方源升级:SHA-256 校验 → 解包 → 原子替换 → 自动重启,可回滚 |
| Docker 兼容 | 保留 docker CLI 与 /var/run/docker.sock,原有脚本、compose 文件无需改动 |
界面截图
容器管理

镜像管理

引擎管理

为什么需要它
官方只提供 .deb / .rpm 包,安装脚本会强制检查 systemd、apt/dnf:
[ -d /run/systemd/system ] || fail "Kiri for Linux runs as a systemd service, and this system has no systemd."
而 OpenWrt 用的是 procd + musl + opkg,直接安装必然失败。
好消息是:Kiri 的二进制是 静态链接(无 PT_INTERP、无 GLIBC_* 符号依赖),
在 musl 上可以直接运行。本项目所做的就是把这件事工程化:
- 把
.deb解包后按 OpenWrt 的目录安装; - 用 procd 服务替代 systemd unit;
- 数据目录放到
/overlay(/var在 OpenWrt 上是 tmpfs,重启即失); - 提供 LuCI 界面与在线升级。
环境要求
- OpenWrt(procd + opkg),已在 OpenWrt 24.10.5 / aarch64(Rockchip) 实测
- 架构:aarch64 或 x86_64(Kiri 官方 Linux 构建只有这两个)
- 内存:建议 ≥ 1 GB;跑图形桌面容器建议 ≥ 2 GB
- 磁盘:
/overlay至少 1 GB 可用(镜像存放在/overlay/kiri)
依赖(install.sh 会用 opkg 自动尝试安装):
| 依赖 | 作用 | 缺失后果 |
|---|---|---|
curl |
下载 Kiri 官方安装包 | 必须,脚本会提示先装 |
node ≥ 22.15 |
解包 .deb、在线升级 |
首次安装失败(可改用电脑解包) |
luci-lua-runtime + luci-compat |
Lua 版 LuCI 运行时 | 管理页不会出现在菜单 |
官方 OpenWrt 24.10 镜像默认使用 ucode/JS 版 LuCI,不含 Lua 运行时, 脚本会自动
opkg install luci-lua-runtime luci-compat。 部分第三方固件(BleachWrt、iStoreOS 及其衍生版)已经自带。
安装
方式一:一键脚本(推荐)
路由器上没有
git,不能在路由器上直接git clone。用下面两种方式之一。
A. 路由器能上网 —— 直接下载 tar 包安装
wget -O /tmp/kiri.tar.gz https://github.com/kasuga77/luci-app-kiri/archive/refs/heads/main.tar.gz
tar -xzf /tmp/kiri.tar.gz -C /tmp
cd /tmp/luci-app-kiri-main && sh scripts/install.sh
B. 在电脑上 clone 后传过去
git clone https://github.com/kasuga77/luci-app-kiri.git
scp -r luci-app-kiri [email protected]:/tmp/
ssh [email protected] 'cd /tmp/luci-app-kiri && sh scripts/install.sh'
脚本依次完成:补齐依赖(Lua 运行时 / Node.js)→ 下载并 SHA-256 校验 Kiri 官方安装包 → 解包安装 → 装 LuCI 页面 → 注册 procd 自启 → 启动服务 → 清理 LuCI 缓存。
安装完成后访问:
http://<路由器IP>/cgi-bin/luci/admin/kiri/containers
左侧菜单会出现 Kiri → 容器 / 镜像 / 引擎。
方式二:OpenWrt SDK 编译
cp -r luci-app-kiri package/
make package/luci-app-kiri/compile V=s
得到 luci-app-kiri_0.1.0_all.ipk,用 opkg install 安装即可。
(Kiri 引擎二进制仍由脚本下载,不随 ipk 分发。)
手动安装(无 Node.js)
解包需要 Node.js。若你的设备没有,可以在电脑上解包后拷贝:
# 电脑上
node luci-app-kiri/root/usr/libexec/kiri/luci-update.js --unpack kiri_0.3.0_arm64.deb out/
scp -r out/usr [email protected]:/usr/
然后照常执行 install.sh 的剩余步骤。
使用
网页
| 页面 | 能做什么 |
|---|---|
| Kiri → 容器 | 查看所有容器及状态/端口;启动、停止、重启、删除;查看日志;表单创建新容器 |
| Kiri → 镜像 | 查看镜像与大小;删除;清理未使用镜像 / 已停止容器 |
| Kiri → 引擎 | 守护进程状态、重启/停止/启动、引擎信息、存储占用、自检、版本更新 |
命令行
docker ps # 直接复用 docker CLI
docker run -d --name web -p 8080:80 nginx:alpine
docker compose up -d # compose / buildx 已随包提供
kiri engine status # 引擎状态
kiri storage status # 存储占用
/etc/init.d/kiri restart # 重启引擎
在线升级是怎么做的
固件里没有 systemd / dpkg / rpm,所以升级流程是自己实现的(luci-update.js):
读取 https://download.runkiri.com/SHA256SUMS-linux
→ 解析出最新版本与对应 kiri_<版本>_<架构>.deb
→ curl 下载到 /tmp
→ SHA-256 校验(不匹配立即丢弃)
→ ar 解包 → zstd 解压 data.tar.zst → tar 解出文件树
→ 备份当前二进制到 /overlay/kiri-backup/kiri-<旧版本>
→ 原子 rename 替换(同文件系统 rename,避开运行中文件的 ETXTBSY)
→ 重启 /etc/init.d/kiri,回读版本号确认
升级过程在后台独立进程执行,进度写入 /tmp/kiri-update/status.json,前端轮询显示,
不会因为 HTTP 请求超时而中断。
失败回滚:/overlay/kiri-backup/kiri-<版本>/ 里保存了旧二进制,拷回 /usr/bin 与
/usr/libexec/kiri 后重启服务即可。
目录结构
luci-app-kiri/
├── README.md
├── LICENSE
├── luci-app-kiri/ # OpenWrt 软件包
│ ├── Makefile # SDK 编译入口
│ ├── luasrc/ # LuCI 资源(Lua MVC)
│ │ ├── controller/kiri.lua # 路由与菜单
│ │ ├── model/kiri.lua # 引擎/容器/升级 逻辑封装
│ │ └── view/kiri/
│ │ ├── containers.htm # 容器页
│ │ ├── images.htm # 镜像页
│ │ ├── engine.htm # 引擎页(含版本更新)
│ │ └── logs.htm # 日志页
│ └── root/ # 会被直接拷到路由器 / 的文件
│ ├── etc/init.d/kiri # procd 服务脚本
│ ├── usr/libexec/kiri/
│ │ └── luci-update.js # 版本检查 / 升级 / 解包(Node)
│ └── usr/share/rpcd/acl.d/
│ └── luci-app-kiri.json # ACL
└── scripts/
├── install.sh # 一键安装
└── uninstall.sh # 一键卸载
运行时路径:
| 路径 | 用途 |
|---|---|
/usr/bin/kiri、kiri-init、kfg、kiri-forge |
引擎与工具 |
/usr/libexec/kiri/ |
docker CLI、compose、buildx 插件、升级脚本 |
/etc/init.d/kiri |
procd 服务 |
/overlay/kiri |
数据目录(镜像 blob、容器、卷) |
/overlay/kiri-daemon |
引擎解包工作区(/var/lib/kiri 的软链目标,见 FAQ) |
/run/kiri/docker.sock |
引擎套接字,软链到 /var/run/docker.sock |
/overlay/kiri-backup/ |
升级前的二进制备份 |
常见问题
Q:能直接 opkg install 吗?
只有一个 LuCI 前端包,Kiri 引擎二进制需要脚本从官方源下载(不随本仓库分发)。
Q:和原本的 Docker 冲突吗?
会。两者都监听 /var/run/docker.sock、都要管理 iptables 与 cgroup,不要同时运行。
如需切换,请先停用并卸载 dockerd/containerd。
Q:升级后数据会丢吗?
不会。镜像与容器在 /overlay/kiri,升级只替换 /usr 下的程序文件,并会先备份旧版本。
Q:系统升级(sysupgrade)后还在吗?
LuCI 页面和 /usr 下的程序会被清掉,但 /overlay 保留的配置目录还在。
sysupgrade 后重新执行一次 install.sh 即可,镜像和容器都还在。
Q:没有 Node.js 怎么办? 容器功能正常,仅「检查更新 / 立即更新」不可用。可在电脑上解包后手动拷贝,见上文。
Q:拉取较大的镜像时报 failed to unpack ... 怎么办?
OpenWrt 的 /var 是 tmpfs(通常只有物理内存的一半),而 Kiri 会把镜像层解包到
/var/lib/kiri/layers。镜像解包后超过 tmpfs 容量就会失败。
本插件的 /etc/init.d/kiri 已经把 /var/lib/kiri 软链到 /overlay/kiri-daemon,
正常安装不会遇到;如果你是手动安装的,请补上这条软链:
mkdir -p /overlay/kiri-daemon
rm -rf /var/lib/kiri
ln -sfn /overlay/kiri-daemon /var/lib/kiri
Q:内存不够跑不动怎么办?
Kiri 本身占用极小(几 MB)。占用大的是容器里的应用,建议给容器加内存上限:
docker run -d --memory=1g --memory-swap=1g ...
卸载
sh scripts/uninstall.sh # 保留 /overlay/kiri 中的镜像与容器
sh scripts/uninstall.sh --purge # 一并删除
English
Run the Kiri container engine on an OpenWrt soft router with a full LuCI management UI.
Features
| Module | Description |
|---|---|
| Engine service | kiri daemon supervised by procd: starts at boot, respawns on crash, no systemd needed |
| Containers | List / start / stop / restart / remove / logs / create containers from a web form (image, name, ports, command, restart policy) |
| Images | List and remove images, prune unused images, prune stopped containers |
| Engine | Daemon state, start / stop / restart, engine info, storage usage, kiri doctor self-check |
| Online upgrade | Check and install new Kiri releases from the official source: SHA-256 verification → unpack → atomic swap → restart, with rollback |
| Docker compatible | Keeps the docker CLI and /var/run/docker.sock, so existing scripts and compose files work unchanged |
View the LuCI screenshots for the Containers, Images, and Engine pages.
Why this project exists
Upstream only ships .deb / .rpm packages, and the official installer hard-requires systemd and apt/dnf:
[ -d /run/systemd/system ] || fail "Kiri for Linux runs as a systemd service, and this system has no systemd."
OpenWrt uses procd + musl + opkg, so the official installer can never work there.
The good news: Kiri's binaries are statically linked (no PT_INTERP, no GLIBC_* symbol
versions), so they run fine on musl. This project does the engineering around that:
- unpack the
.deband lay the files out the OpenWrt way; - replace the systemd unit with a procd service;
- keep data on
/overlay(/varis tmpfs on OpenWrt and is wiped on reboot); - ship a LuCI UI and an in-place updater.
Requirements
- OpenWrt (procd + opkg); tested on OpenWrt 24.10.5 / aarch64 (Rockchip)
- Architecture: aarch64 or x86_64 (the only Linux builds upstream provides)
- RAM: ≥ 1 GB recommended; ≥ 2 GB for a graphical desktop container
- Disk: at least 1 GB free on
/overlay(images live in/overlay/kiri)
Dependencies (install.sh tries to install them with opkg):
| Dependency | Purpose | If missing |
|---|---|---|
curl |
Download the official Kiri package | Required; the script tells you to install it |
node ≥ 22.15 |
Unpack .deb, online upgrade |
First install fails (unpack on a PC instead) |
luci-lua-runtime + luci-compat |
Lua-based LuCI runtime | The menu entry never appears |
Stock OpenWrt 24.10 ships the ucode/JS LuCI and has no Lua runtime, so the script runs
opkg install luci-lua-runtime luci-compatautomatically. Some community firmware (BleachWrt, iStoreOS and derivatives) already includes them.
Installation
Option 1: one-line installer (recommended)
The router has no git, so you cannot
git cloneon the device. Use one of the two paths below.
A. The router has internet — download and run
wget -O /tmp/kiri.tar.gz https://github.com/kasuga77/luci-app-kiri/archive/refs/heads/main.tar.gz
tar -xzf /tmp/kiri.tar.gz -C /tmp
cd /tmp/luci-app-kiri-main && sh scripts/install.sh
B. Clone on your PC, then copy it over
git clone https://github.com/kasuga77/luci-app-kiri.git
scp -r luci-app-kiri [email protected]:/tmp/
ssh [email protected] 'cd /tmp/luci-app-kiri && sh scripts/install.sh'
The installer resolves dependencies (Lua runtime / Node.js), downloads the official Kiri package and verifies its SHA-256, unpacks and installs it, installs the LuCI pages, registers the procd service, starts it, and clears the LuCI caches.
Then open:
http://<router-ip>/cgi-bin/luci/admin/kiri/containers
A Kiri → Containers / Images / Engine menu appears in LuCI.
Option 2: build with the OpenWrt SDK
cp -r luci-app-kiri package/
make package/luci-app-kiri/compile V=s
This produces luci-app-kiri_0.1.0_all.ipk; install it with opkg install.
(The Kiri engine binaries are still downloaded by the script and are not shipped in the ipk.)
Manual install (no Node.js)
Unpacking needs Node.js. If your device has none, unpack on a PC and copy the result:
# on your PC
node luci-app-kiri/root/usr/libexec/kiri/luci-update.js --unpack kiri_0.3.0_arm64.deb out/
scp -r out/usr [email protected]:/usr/
Then run the remaining steps of install.sh as usual.
Usage
Web UI
| Page | What it does |
|---|---|
| Kiri → Containers | All containers with state and ports; start, stop, restart, remove; logs; create a container from a form |
| Kiri → Images | Images and sizes; remove; prune unused images and stopped containers |
| Kiri → Engine | Daemon state, start / stop / restart, engine info, storage usage, self-check, version update |
Command line
docker ps # the docker CLI works as-is
docker run -d --name web -p 8080:80 nginx:alpine
docker compose up -d # compose and buildx are bundled
kiri engine status # engine state
kiri storage status # storage usage
/etc/init.d/kiri restart # restart the engine
How the online upgrade works
There is no systemd, dpkg or rpm on the device, so the updater is implemented in
luci-update.js:
read https://download.runkiri.com/SHA256SUMS-linux
→ pick the newest version and its kiri_<version>_<arch>.deb
→ download it with curl into /tmp
→ verify its SHA-256 (discard on mismatch)
→ parse the ar archive → zstd-decompress data.tar.zst → tar-extract the tree
→ back up the current binaries to /overlay/kiri-backup/kiri-<old-version>
→ swap files with an atomic rename (same filesystem, so no ETXTBSY on the running binary)
→ restart /etc/init.d/kiri and read the version back to confirm
The upgrade runs in a detached process and writes progress to /tmp/kiri-update/status.json,
which the page polls — so an HTTP request timeout can never interrupt it.
Rollback: the previous binaries are in /overlay/kiri-backup/kiri-<version>/; copy them back
to /usr/bin and /usr/libexec/kiri and restart the service.
Repository layout
luci-app-kiri/
├── README.md
├── LICENSE
├── luci-app-kiri/ # OpenWrt package
│ ├── Makefile # SDK build entry point
│ ├── luasrc/ # LuCI resources (Lua MVC)
│ │ ├── controller/kiri.lua # routes and menu
│ │ ├── model/kiri.lua # engine / container / update logic
│ │ └── view/kiri/
│ │ ├── containers.htm # containers page
│ │ ├── images.htm # images page
│ │ ├── engine.htm # engine page (with update)
│ │ └── logs.htm # log viewer
│ └── root/ # copied verbatim to the router's /
│ ├── etc/init.d/kiri # procd service script
│ ├── usr/libexec/kiri/
│ │ └── luci-update.js # check / upgrade / unpack (Node)
│ └── usr/share/rpcd/acl.d/
│ └── luci-app-kiri.json # ACL
└── scripts/
├── install.sh # one-step install
└── uninstall.sh # one-step uninstall
Runtime paths:
| Path | Purpose |
|---|---|
/usr/bin/kiri, kiri-init, kfg, kiri-forge |
engine and its tools |
/usr/libexec/kiri/ |
docker CLI, compose and buildx plugins, updater |
/etc/init.d/kiri |
procd service |
/overlay/kiri |
data directory (image blobs, containers, volumes) |
/overlay/kiri-daemon |
engine unpack workspace (target of the /var/lib/kiri symlink, see FAQ) |
/run/kiri/docker.sock |
engine socket, symlinked to /var/run/docker.sock |
/overlay/kiri-backup/ |
pre-upgrade binary backups |
FAQ
Q: Can I just opkg install it?
Only the LuCI front-end is packaged. The Kiri engine binaries are downloaded from the
official source by the script (they are not redistributed here).
Q: Does it conflict with Docker?
Yes. Both listen on /var/run/docker.sock and both manage iptables and cgroups —
do not run them together. Stop and remove dockerd/containerd first.
Q: Will I lose data on upgrade?
No. Images and containers live in /overlay/kiri; an upgrade only replaces program files
under /usr and backs up the old ones first.
Q: Does it survive a sysupgrade?
The LuCI pages and the programs under /usr are wiped, but what /overlay keeps is still
there. Re-run install.sh after a sysupgrade and your images and containers come back.
Q: What if there is no Node.js? Containers work normally; only "Check for updates / Update now" is unavailable. You can unpack on a PC and copy the files, see above.
Q: failed to unpack ... when pulling a large image?
/var is tmpfs on OpenWrt (usually half of RAM) and the engine unpacks image layers into
/var/lib/kiri/layers, so an image whose unpacked size exceeds tmpfs fails.
This plugin's /etc/init.d/kiri already symlinks /var/lib/kiri to
/overlay/kiri-daemon, so a normal install never hits it. If you installed manually:
mkdir -p /overlay/kiri-daemon
rm -rf /var/lib/kiri
ln -sfn /overlay/kiri-daemon /var/lib/kiri
Q: Not enough memory? Kiri itself is tiny (a few MB). The memory goes to the applications inside your containers; cap them:
docker run -d --memory=1g --memory-swap=1g ...
Uninstall
sh scripts/uninstall.sh # keeps images and containers in /overlay/kiri
sh scripts/uninstall.sh --purge # removes them too
License / 许可
- This project's code: MIT
- The Kiri engine is copyright runkiri.com. This project only calls the official download source and does not redistribute its binaries.
- Read Kiri's own license terms before use.
Disclaimer / 免责声明
中文:本项目为社区作品,与 Kiri 官方无关。容器引擎涉及内核命名空间、cgroup、iptables 等底层操作,请自行评估风险;在生产路由上操作前建议先备份配置。
English: This is a community project, not affiliated with Kiri upstream. A container engine touches kernel namespaces, cgroups and iptables; judge the risk yourself and back up your router configuration before using it in production.
Explore related projects
Loading…