untainer
Get started

CLI

Every untainer command and option, written from the CLI's own help.

Note

Written by node site/scripts/reference.ts from the CLI's own help (untainer <command> --help); do not edit it by hand.

#untainer

untainer - Containers on unkernel

untainer <COMMAND> [OPTIONS]

OCI images as lazily loaded micro-images, run as containers in an unkernel VM. No Docker, no server: a micro-image is a directory of static files any CDN can serve.

Command
buildBuild a micro-image from an OCI image in a registry
baseBuild a base image that other images are built over
runRun an image directory or a reference in a container
upStart the services of a compose file, each in its container
psList the containers run in the background (run -d)
logsPrint the output of a container run in the background
stopStop containers run in the background
inspectShow the layers, sizes and configuration of an image
imagesList the images and the rest of the cache directory
pruneRemove unused images, layers and chunks from the cache directory
serveServe images and pages over HTTP, with the headers untainer needs
benchMeasure a cold and a warm start of an image
Option
-h, --helpPrint help
untainer build postgres:17-alpine
untainer run dist/postgres-17-alpine -e POSTGRES_PASSWORD=dev
untainer run node:24-alpine -u node -- node -e "console.log(1)"

Documentation: https://untainer.dev

#untainer build

Build a micro-image from an OCI image in a registry

untainer build <REF> [OPTIONS] [-- <COMMAND>...]

Takes the linux/arm64 variant of REF, merges its layers into one erofs image in an unkernel VM (no distro image, no network in the guest) and writes manifest.json, layers/ and chunks/ to DIR. Layers are cached by digest in ~/.cache/untainer, so the next build of the image downloads nothing.

Argument
<REF>Image reference: postgres:17-alpine, ghcr.io/org/app:v1, app@sha256:...
<COMMAND>...With --probe: the command of the profiling start (not recorded)
Option
-o, --out <DIR>Output directory (default: dist/-)
--chunk-size <SIZE>Bytes per chunk, or with k or m (default: 256k)
--zstd-level <N>zstd level 1-22 (default: 3; 19: ~14% smaller, far slower, for publishing)
--probe <PROBE>Readiness probe to record: tcp:, http:, exec:
--memory <MiB>Guest memory the image needs, to record (default with --probe: measured)
-e, --env <KEY=VALUE>Environment for that measuring start (repeatable; not recorded)
--profile-script <SH>With --probe, a script run in the container once ready, as load: its reads and memory count (not recorded)
--no-profileWith --probe, do not start the image (no memory, no boot bundle)
--no-layoutWith --probe, keep the flat layout instead of laying it out by the start
--profile <FILE>Take the starts' results from an earlier build's profile.json: the same image, no start
--boot-part-size <SIZE>Largest boot bundle part, or with k or m; 0: none (default: 4m)
--base <DIR>Base image to build over when the layers start with its (repeatable; default: those of untainer base)
--no-baseBuild no base layer, even when one matches
--slim[=files|chunks]With --probe, remove files its start does not touch, then start it again; =chunks: also the unread parts of files it touched (the image then does only what the probe did)
--keep <PATH>With --slim, keep this file or directory whole (repeatable)
--no-traceWith --slim, keep only what --keep names, not what the start reads
--mirror <URL>Docker Hub mirror for when Docker Hub answers 429 (repeatable)
--jsonPrint the result as JSON
-h, --helpPrint help
untainer build node:24-alpine
untainer build ghcr.io/org/app:v1 -o ./app --probe http:8080/health
untainer build postgres:17-alpine --probe tcp:5432 -e POSTGRES_PASSWORD=dev
untainer build postgres:17-alpine --chunk-size 128k --json
untainer build ghcr.io/org/app:v1 -o ./publish/app --zstd-level 19

#untainer base

Build a base image that other images are built over

untainer base <REF> [OPTIONS]

Builds REF like untainer build, as one layer marked as a base, laid out and bundled by a start of its shell. Later builds of images whose layers start with REF's use it as their bottom layer and keep only what they add: images over the same base share its chunks.

Argument
<REF>Image reference: alpine:3.24, debian:bookworm-slim
Option
-o, --out <DIR>Output directory (default: ~/.cache/untainer/bases/-)
--mirror <URL>Docker Hub mirror for when Docker Hub answers 429 (repeatable)
-h, --helpPrint help
untainer base alpine:3.24
untainer build node:24-alpine --probe http:3000/

#untainer run

Run an image directory or a reference in a container

untainer run <IMAGE> [OPTIONS] [-- <COMMAND>...]

Streams the container's output until it exits; Ctrl-C stops it. untainer exits with the container's exit code. Its own messages go to stderr, so the container's stdout can be piped.

Argument
<IMAGE>Image directory, gh:/npm:/https:// micro-image, or an OCI reference (built first)
<COMMAND>...Replaces the image's command
Option
-e, --env <KEY=VALUE>Add to the environment (repeatable)
-p, --publish <HOST:CONTAINER>Publish a container port on 127.0.0.1 (repeatable)
-v, --volume <HOST:CONTAINER[:ro]>Mount a host directory, owned by the container user (repeatable)
--tmpfs <CONTAINER[:MiB]>Mount an empty tmpfs, owned by the container user (repeatable)
--name <NAME>Container name
-u, --user <USER>user, uid, user:group or uid:gid (default: the image's)
-w, --workdir <DIR>Working directory (default: the image's)
--no-initRun the command itself as PID 1, without untainer's init
--memory <MiB>Guest memory (default: the image's profile.memoryMiB, else 1024)
--net[=all]Give the guest the internet, but not this host, its local network or link-local (=all: all)
-d, --detachRun in the background, in a VM of its own; print the name (default: the image name)
-h, --helpPrint help
untainer run dist/postgres-17-alpine -e POSTGRES_PASSWORD=dev
untainer run -d -p 5432:5432 dist/postgres-17-alpine -e POSTGRES_PASSWORD=dev
untainer run node:24-alpine -u node -- node -e "console.log(process.version)"
untainer run gh:user/images/postgres-17#v1 -e POSTGRES_PASSWORD=dev

Without --net the guest has no network. --net checks each connection on the address it goes to and refuses loopback, this host's own addresses, 10/8, 172.16/12, 192.168/16, 100.64/10, 169.254/16 (cloud metadata), multicast, reserved ranges and the IPv6 equivalents.

#untainer up

Start the services of a compose file, each in its container

untainer up [OPTIONS]

Reads image, environment, ports, volumes, depends_on and command of each service, and warns about the keys it ignores. A service starts once the ones it depends on are ready (their probes passed); the others reach it by its name. All share one VM. Each service's output follows, prefixed with its name; Ctrl-C stops them all.

Option
-f, --file <FILE>Compose file (default: compose.yaml, compose.yml, docker-compose.yaml)
-p, --project-name <NAME>The project's name, for its named volumes (default: name:, else the directory)
--memory <MiB>Guest memory (default: the sum of the images' profile.memoryMiB)
--net[=all]Give the guests the internet, but not this host, its local network or link-local (=all: all)
-h, --helpPrint help
untainer up
untainer up -f examples/compose/compose.yaml

An image is an image directory (relative to the file), a gh:/npm:/https:// micro-image, or an OCI reference (built first). A named volume is a directory in ~/.cache/untainer/volumes.

#untainer ps

List the containers run in the background (run -d)

untainer ps [OPTIONS]

Each runs in a background untainer process with a VM of its own; its state file and output are in ~/.cache/untainer/containers. A container whose process died without saying how it ended (SIGKILL, a restart) shows as gone.

Option
-a, --allAlso the containers that exited
--jsonPrint the state files as JSON
-h, --helpPrint help

#untainer logs

Print the output of a container run in the background

untainer logs <NAME> [OPTIONS]

Its stdout and stderr in one, and untainer's own lines (the start, errors).

Argument
<NAME>The container, as untainer ps lists it
Option
-f, --followGo on printing what it writes until it exits
-h, --helpPrint help

#untainer stop

Stop containers run in the background

untainer stop <NAME>...

Sends SIGTERM to each container, as Ctrl-C does for untainer run (SIGKILL after 10 s), and waits until its VM is gone. Its state and output stay for untainer ps -a and untainer logs.

Argument
<NAME>...The containers, as untainer ps lists them
Option
-h, --helpPrint help

#untainer inspect

Show the layers, sizes and configuration of an image

untainer inspect <DIR> [OPTIONS]
Argument
<DIR>Image directory
Option
--jsonPrint the manifest and the layer sizes as JSON
-h, --helpPrint help
untainer inspect dist/postgres-17-alpine

#untainer images

List the images and the rest of the cache directory

untainer images [OPTIONS]

Lists the images in the cache directory (built by untainer run ) with their size on disk and when they were written, then what else the cache holds. There is no daemon: this reads the files.

Option
--jsonPrint the list as JSON
-h, --helpPrint help
untainer images
untainer images --json

#untainer prune

Remove unused images, layers and chunks from the cache directory

untainer prune [OPTIONS]

Removes what is unused or can be made again without the network: directories that hold no valid image, decompressed layer tars, downloads older than an hour, and chunks no stored layer index lists. --all also removes what can be downloaded or built again: OCI layers, built images, the chunk store, toolbox packages.

Option
--dry-runShow what would be removed, remove nothing
--allAlso remove everything that can be downloaded or built again
-h, --helpPrint help
untainer prune --dry-run
untainer prune --all

#untainer serve

Serve images and pages over HTTP, with the headers untainer needs

untainer serve [DIR] [OPTIONS]

Serves DIR (default: the current directory) with CORS for other origins, immutable caching for chunks and layer indexes, and byte ranges. Without COOP and COEP by default, as most static hosts serve; --isolate adds them (shared memory between the page and the VM, more CPUs).

Argument
[DIR]Directory to serve (default: .)
Option
-p, --port <PORT>Port (default: 8080; 0 for any free one)
--host <HOST>Address to listen on (default: 127.0.0.1)
--isolateSend COOP and COEP, so its pages are cross-origin isolated
-h, --helpPrint help
untainer serve dist
untainer serve examples/browser/dist --port 3000 --isolate

#untainer bench

Measure a cold and a warm start of an image

untainer bench <IMAGE> [OPTIONS] [-- <COMMAND>...]

Starts IMAGE until its probe passes, twice: cold (an empty chunk store and cache) and warm (the store the cold start filled, a new cache). Prints the time to ready and where the chunks came from: the source (the network for a URL), the store, the cache.

Argument
<IMAGE>Image directory, URL or reference (gh:, npm:, ...)
<COMMAND>...Replaces the image's command
Option
-e, --env <KEY=VALUE>Add to the environment (repeatable)
--probe <PROBE>Readiness probe (default: the image's, else TCP on its first port)
--memory <MiB>Guest memory (default: the image's profile.memoryMiB, else 1024)
--runs <N>Warm starts after the cold one (default: 1)
--jsonPrint the result as JSON
-h, --helpPrint help
untainer bench dist/node-24-alpine --probe http:3000/ -- node -e "require('http').createServer((q, s) => s.end()).listen(3000)"
untainer bench https://cdn.example/postgres-17/ -e POSTGRES_PASSWORD=dev

untainer  OCI images as containers in a browser tab or in Node.