DOCKER
Kiri ForgeBeta
Kiri Forge is Kiri’s own open-source Dockerfile build engine, written from scratch in Rust as a single binary with no daemon. It builds the Dockerfiles you already have using BuildKit v0.33.1’s rules and produces the same OCI images, without starting a builder container.
Forge in Kiri 0.3.0
Kiri 0.3.0 bundles Kiri Forge 0.1.0, enables it by default for kiri build on macOS, Linux and Windows, and puts kiri-forge and its short name kfg on your PATH.
| System | Where Forge is installed | Commands on PATH |
|---|---|---|
| macOS | Bundled inside Kiri.app (Contents/Resources/bin/kiri-forge). Kiri Lite downloads it on the first Forge build. |
~/.kiri/bin/kiri-forge and ~/.kiri/bin/kfg |
| Linux | Installed by the .deb or .rpm package, or downloaded on the first Forge build when not bundled. |
/usr/bin/kiri-forge and /usr/bin/kfg |
| Windows | Bundled into Kiri’s WSL engine (/usr/local/bin/kiri-forge). |
%LOCALAPPDATA%\Kiri\bin\kiri-forge.exe, kfg.exe, and /usr/local/bin/kiri-forge / kfg in WSL |
When kiri-forge is not already present (for example on Kiri Lite), Kiri downloads and verifies the latest release automatically on the first Forge build. Set KIRI_FORGE_NO_AUTO_INSTALL=1 to disable automatic downloads.
What each build command uses on macOS, Linux and Windows:
| Command | Builder used |
|---|---|
kiri build |
Forge by default. Reads your build folder in place and keeps a persistent kiri-forge worker warm between builds. On Windows, runs Forge inside Kiri’s WSL engine and translates Windows paths. Builds Forge cannot handle yet fall back to BuildKit with a line saying why. |
docker build, docker buildx build, docker compose build |
BuildKit (unchanged by the Forge setting). Follows your active docker context, or always uses Kiri’s kiri-build BuildKit container when set with kiri build-with kiri. See Builds. |
kfg build, kiri-forge build, kiri forge |
Forge directly. Sends ordinary builds to Kiri’s engine when Kiri is running, or runs standalone with --standalone (or when no engine is running). |
Switching between Forge and BuildKit
BuildKit stays installed alongside Forge. You can switch kiri build back to BuildKit, and back to Forge, at three levels. The first one given wins:
- One build only: pass
--builder buildkit(or--no-native, which is identical) tokiri build. Pass--builder forge(or--builder kiri) to force Forge for one build when BuildKit is the default. - One terminal or session: set
KIRI_NATIVE_BUILD=0(0,falseoroff) for BuildKit, orKIRI_NATIVE_BUILD=1(any other non-empty value) for Forge. Kiri checks the terminal’s environment first, then the engine’s. - All
kiri buildruns: runkiri builder use buildkitto switch to BuildKit, orkiri builder use forgeto switch back. In Kiri’s window, open Settings → Builds and set Build with Forge to Off or On.
In an interactive terminal (unless -q or --progress quiet is passed), kiri build prints building with Forge or building with BuildKit before the build output.
$ kiri builder status
kiri build uses Forge, Kiri's own build engine. A build it can't do yet goes to BuildKit. Back to BuildKit: kiri builder use buildkit
Forge: kiri-forge 0.1.0 (installed)
BuildKit: stopped, build cache up to 20 GB, stops after 5 min idle
$ kiri builder use buildkit
Set: kiri build uses BuildKit from now on, as before Forge.
$ kiri builder use forge
Set: kiri build uses Forge, Kiri's own build engine, from now on. A build it can't do yet goes to BuildKit.
$ kiri build --builder buildkit -t myapp .Settings
Updating Forge
Forge updates both with Kiri and on its own. Each Kiri release bundles a pinned kiri-forge, and Forge also publishes its own release feed (download.runkiri.com/latest-forge-<os>-<arch>.json), so you can install a newer Forge without waiting for a Kiri release. When Kiri finds more than one copy (bundled in Kiri, installed by an update, or a standalone copy such as Homebrew’s), it runs the highest compatible version.
Updating Forge does not restart Kiri or stop running containers. Kiri downloads the release, checks its SHA-256 and signature (Apple Developer ID on macOS; signed SHA256SUMS.asc on Linux and WSL), replaces the binary atomically, and hot-swaps any running kiri-forge worker in place.
In Kiri’s window
Kiri checks Forge’s feed alongside Kiri’s own updates when the window opens and every 6 hours while it stays open. Turning Settings → About → Check for updates automatically to Off stops background checks for both.
- Status bar chip: shows
Forge <current> → <latest>when a newer release is available, Updating Forge while installing, and Forge<version>live once the worker is hot-swapped. Clicking the chip opens the update card. - Update card: appears in the bottom-right corner with Kiri Forge
<version>is available and Updates in place — running containers keep running. It offers Update Forge, Snooze ▾ (Tomorrow or In a week), Skip this version, and What’s new when release notes are present. If a Kiri update is out at the same time, Kiri’s update card includes a footer row (Forge<version>is also out (no restart)) with an Update Forge only button. Once installed, the card reports Worker hot-swapped — no restart needed. - Settings → About and Settings → Builds: both show Forge’s current version with Check now (or
<version>available, Update Forge, and What’s new).
From the command line
kiri builder check # check for a newer kiri-forge release (same as: kiri forge check)
kiri builder update # download, verify and install the latest Forge (-y skips the prompt)
kiri update --forge # update Forge only (add --check to check without installing)
kiri update --check # check both Kiri and ForgeRunning kiri update when Kiri itself is already up to date also checks Forge and updates it if a newer release is out.
How a build works
Forge reads the Dockerfile in a sealed child process. That process has no files, no network, and fixed limits on memory, stack and time, so a hostile recipe can only fail its own build. The result is a plan: a graph of small steps, each with the image config and history it produces.
A build driver then runs the steps. Stages that do not depend on each other run at the same time. Each step’s changes are written as one layer of the image.
What is reused between builds
Each step is cached by exactly what it reads. Its key is made of three things:
| Part of the key | What it means |
|---|---|
| The step itself | The instruction and its settings. |
| Its parent | The step before it in the stage. |
| The files it takes in | The content of the files a COPY or ADD reads from the build context, after .dockerignore is applied. |
A step whose key has not changed comes straight from the cache. When a step does change, that step and the ones after it in its stage run again. Steps in other stages that did not read the changed files stay cached.
--no-cache builds without the cache, and --no-cache-filter does so for the stages you name.
Forge follows BuildKit v0.33.1’s Dockerfile rules so the image config, history and layers match docker build, byte for byte where possible. Its test suite checks Forge against more than 5,000 recorded BuildKit answers and about 990 whole-build comparisons.
Using kfg and kiri-forge
kfg is the short command you type; kiri-forge is the same program under its long name. Both share one store, and kiri forge runs the same subcommands (kiri forge . is shorthand for building the current folder).
When Kiri is running, kfg build sends standard builds to Kiri’s engine. Pass --standalone (for example in scripts or CI) so Forge builds in its own process, pulls base images with its own registry client, and stores layers and images in its own store (~/.local/share/kiri-forge, $XDG_DATA_HOME/kiri-forge, or /var/lib/kiri-forge as root; KIRI_FORGE_STATE moves it).
# Build in Forge's own store, or build and load straight into Kiri or Docker
kfg build --standalone -t hello:latest .
kfg build --standalone --load -t hello:latest .
# Push to a registry (reads logins from ~/.docker/config.json)
kfg build --standalone -t ghcr.io/you/app:1.0 --push .
# Build for more than one platform and push an image index
kfg build --standalone -t ghcr.io/you/app:1.0 --platform linux/amd64,linux/arm64 --push .
# Share build cache through a registry
kfg build --standalone -t ghcr.io/you/app:1.0 \
--cache-from type=registry,ref=ghcr.io/you/app:cache,ignore-error=true \
--cache-to type=registry,ref=ghcr.io/you/app:cache,mode=max \
--push .-o chooses where the built image goes:
| Flag | Result |
|---|---|
| (none) | The image stays in Forge’s store, or goes to the engine that ran the build. |
--load |
Also load the image into the Kiri or Docker engine on this machine. |
--push |
Push to the registry named by -t. |
-o type=docker,dest=app.tar |
A Docker image archive for docker load. |
-o type=oci,dest=app.tar |
An OCI image layout in a tar archive. |
-o type=tar,dest=app.tar |
A plain tar archive of the image’s files. |
-o type=local,dest=out/ |
The image’s files unpacked into a folder. |
Standard build flags work as in docker buildx build: -f, -t, --build-arg, --label, --target, --platform, --secret, --ssh, --build-context, --no-cache, --no-cache-filter, --pull, --network, --shm-size, --ulimit, --iidfile, --progress (auto, plain, tty, quiet) and -q. Run kfg build --help for the full list.
Manage the standalone store with:
kfg images # list images in Forge's store
kfg du # disk used by layers, caches and images
kfg prune # remove unused layers and dangling images
kfg prune -a # also empty the build cache
kfg rmi hello:latest # remove an image
kfg version # print Forge's version and platformInstalling without Kiri
To use Kiri Forge on a machine without Kiri (macOS or Linux), install it with Homebrew:
brew install libracoder/kiri/forge
kfg versionOn Homebrew 7 and newer, trust the tap first with brew trust libracoder/kiri. Prebuilt release archives for Linux (x86_64, aarch64) and macOS (Apple silicon and Intel) are also published at github.com/libracoder/kiri-forge.
Current limits
When kiri build asks for something Forge does not cover yet, Kiri sends the whole build to BuildKit before running anything and prints one line explaining why. Inside Kiri, that currently includes:
- Git or other remote contexts other than plain
http://orhttps://URLs, and a build context read from stdin (-). - Builds run from an integrated WSL distro other than Kiri’s own.
-o/--outputexporters other thantype=docker(usekfg buildforoci,tar,localorregistryoutputs, or letkiri buildfall back to BuildKit).- Unrecognised
docker build/buildxflags, or--allowentitlements beyondnetwork.hostandsecurity.insecure.
Limits in Kiri Forge 0.1.0 itself:
- Other frontends: Forge builds Dockerfiles with its built-in frontend only (
# syntax=docker/dockerfile:1, up to1.27.1). Other# syntax=frontend images,BUILDKIT_SYNTAXnaming another frontend, anddocker buildx bakefiles are not run. - Cache backends:
--cache-fromsupportstype=localandtype=registry;--cache-tosupportstype=local,type=inlineandtype=registry. Other backends, such astype=ghaandtype=s3, are refused. RUNfor another CPU: multi-platform builds work on any machine when the steps are onlyCOPYandADD. ARUNstep for another CPU requires a Linuxbinfmt_miscemulator registered with theF(fix-binary) flag (such asqemu-user-static). Forge does not ship emulators.RUNneeds Linux: on macOS, standalonekfgcannot run aRUNstep on its own because its sandbox uses Linux namespaces. It delegatesRUNsteps to Kiri’s engine or another Linux container engine on your Mac.- Ubuntu, as an ordinary user (standalone): Ubuntu 24.04 and later block unprivileged user namespaces via AppArmor. Run standalone builds with
sudoor add an AppArmor profile for/usr/local/bin/{kiri-forge,kfg}as shown in the Forge README. - Disk and long steps: Forge’s store keeps layers unpacked beside the archives so
RUNsteps mount immediately, which uses extra disk untilkfg prune. Forge removes builder overhead rather than speeding up work inside an uncachedRUNstep such as a long compile or download.
How docker build, buildx and the Builds view work in Kiri.
How Kiri checks, verifies and installs releases.
Images and RosettaWhere built images live and how other architectures run.
© 2026 Kiri · runkiri.com