- Snapshots are point-in-time, read-only copies of a single box’s root. You restore them back onto the same box to roll its state forward or backward.
- Bases are reusable, read-only templates. Every box you create is a writable clone of a base, so a base is how you bake an environment once and stamp out many boxes from it.
Internally the API calls a box a “fork”, so you will see
fork-flavored names in some CLI argument help. User-facing tools and this documentation call it a box. Both terms refer to the same thing.Snapshots
A snapshot is a read-only copy of one box’s root filesystem at a moment in time. Snapshots are namespaced per box: you can only restore a snapshot onto the box it was taken from. There is no cross-box restore.Create a snapshot
v0, v1, v2, and so on, picking the next number above the highest existing one.
To set the name yourself, pass it as a positional argument, and add a description with -m:
--name flag, which overrides the positional argument. Creating a snapshot whose name already exists returns a conflict.
Snapshot names accept the pattern
^[a-zA-Z0-9_.-]+$. Lowercase a-z0-9- is still the recommended convention for consistency with box and host naming.List snapshots
NAME, SIZE, CREATED, and DESCRIPTION columns. The created timestamp is RFC3339.
Restore a snapshot
Diffing against a snapshot
Use4kr diff to see what has changed in a box’s root filesystem since a snapshot. Diffs are root-only by construction.
Status
--against, the diff compares against the most recent snapshot. If the box has no snapshots, the command reports that you must specify one:
+), modified (~), and deleted (-) paths, or No changes when the trees match.
A single file
added, deleted, modified, or unchanged; for a modified file, a unified diff is included.
File diffs are limited to 1 MB. Diffing a file larger than that returns an error. Use
--against here too to pick a specific snapshot.Bases
A base is a read-only template filesystem. Every box you create is a writable btrfs clone of a base:box-base alias. Bases are read-only, so cloning never modifies the template.
List and inspect bases
NAME, VERSION, SIZE, and CREATED.
To inspect one base, including its versions and the build script of each:
VERSION, KIND, TAG, BUILDER, PARENT, SIZE, and CREATED. The TAG column holds the build script’s sha256. You can filter versions by that sha256 with --tag:
Building a base from a Dockerfile
4kr base build builds a base image from a Dockerfile in your current directory:
linux/amd64, and the image is tagged <name>:latest (lowercased). Forkr auto-detects a container engine in order: docker, then podman, then nerdctl.
On a non-x86_64 host using Docker, docker buildx is required to cross-build for linux/amd64. With buildx, Forkr runs docker buildx build --platform linux/amd64 ... --load; otherwise it runs a plain build --platform linux/amd64. After building, Forkr verifies the image architecture is amd64 and fails on a mismatch.
Once built, Forkr exports the image’s root filesystem as a .tar.gz and uploads it as a new base.
Saving a base from a box
To turn a box’s current root filesystem into a reusable base, use4kr base save with the new base name first and the source box second:
Importing a base from a tarball
You can import a base directly from a.tar.gz of a root filesystem:
--file flag is required. To layer the tarball on top of an existing base, pass a parent:
--parent is also available as -p. With a parent, Forkr snapshots that parent and extracts the tarball on top of it; without one, it extracts into a fresh empty filesystem. Either way, Forkr verifies the base architecture and sets the new base read-only.
On
base import, -p means --parent, not --project. This command has no --project flag.Versioning and aliases
Base names are versioned automatically. The first time you save or import a given name, Forkr writes a subvolume under that exact name and registers an alias pointing at it. Each later write of the same name gets a timestamp suffix like-v20260101120000, and the alias is updated to point at the newest version.
When you run 4kr create --base my-base, Forkr resolves the alias to its latest version and clones that. To pin a box to a specific older version, pass the exact version name as --base.
Where to go next
Boxes
How boxes are created, cloned, and torn down.
Data volumes
Snapshot and back up volume data, which root snapshots and bases do not capture.
Environment
The runtime layout inside a box’s root filesystem.
API reference
The snapshot, diff, and base HTTP endpoints.