docker
The control image from Containerfile holds inf3r-web, the inf3r cli,
and inf3r-probe. Its Rust, Debian, and uv bases are digest-pinned; the
references are repeated in docker/control.lock, the image carries them as
org.inf3r.control.base.* labels, and 08_image.sh writes the resolved values
to target/control.lock. It holds no plugin binary and no engine library. The mock
bundle's manifests are baked into /opt/inf3r/plugins/mock/x64-cpu; the engine
itself is a sibling container from the final bundle image. A model is a mount
and never a layer. Other bundles are delivered as a manifest-only tree mounted
read-only at /opt/inf3r/plugins-extra; compose names it through
INF3R_MANIFEST_DIR, and ops/control-manifests.sh stages two or more bundle
manifests without copying an engine tree or binary. The image also holds uv
and the system Python for the echo
bundle; a bundle that needs another runtime installs it in its own image.
Bundle images
Every bundle owns its complete image recipe. The recipe lives beside its
manifest, normally as plugins/<model>/<target>/Dockerfile, and the image
contains that bundle's engine, plugin entry point, and manifest. There is no
shared engine base, no central engine registry, and no host-side list of
Cargo binaries or engine pins. Two bundles that use the same upstream engine
each build and ship their own copy, because the bundle is the unit of
replacement and may diverge at any time.
ops/images.sh is generic. It stages one bundle directory plus the shared SDK
workspace (Cargo.toml, Cargo.lock, crates/), excludes model/, builds
the bundle's own Dockerfile inside Docker, stamps the generic labels, and tags
the final image:
./ops/images.sh build mock/x64-cpu
./ops/images.sh check mock/x64-cpu
./ops/images.sh tag mock/x64-cpu
The final image is inf3r/<bundle-id>:sha-<12>, where the twelve characters
are the staged-context digest. build also tags the same image
inf3r/<bundle-id>:local, the stable alias that the compose deploy names; the
content tag remains the authority. The final tag, image id, and source digest
are recorded in target/images.lock; the image carries
org.inf3r.bundle.id, org.inf3r.bundle.binary, and
org.inf3r.source.sha256. The image has no model/ directory or weight-like
file, and no default entry point: the deploy file supplies the command and
--socket.
The builder does not impose a language or an engine asset allowlist. A bundle
may contain C, C++, Rust, Python, header files, CMake files, patches, or
lockfiles. It refuses unambiguous weight names, ambiguous weight names above
1 MiB, weight-like magic, symlinks, and the bundle's model/ path. The whole
final image is scanned again for the same name and size rules; staging also
checks magic bytes. A failed Docker run, shell, or find is an error, not a
clean scan.
The control verifies the image before it starts it. A bare name and :latest
are refused. With INF3R_IMAGES_LOCK pointing at the build record, the image
id and source label must match; compose mounts target/images.lock at
/opt/inf3r/images.lock and sets the variable. Without a lock, a content tag
must agree with the label; the local alias is accepted only while the image
still carries its content tag.
Mounts
/var/lib/inf3r is writable and holds the ledger, the blob store, and the
first bearer token. The entry point writes a new 64-hex token there when the
volume does not have one; it never replaces an existing token. Read it with:
docker compose exec inf3r cat /var/lib/inf3r/token
/run/inf3r in the control is a mount of the rootless daemon's runtime
directory. Each engine receives only its own random instance directory below
the host path. The deploy file names both roots: socket_dir is the control
path and socket_host_dir is the host path that the Docker daemon resolves.
They must name the same directory. Change both when the daemon's uid is not
1000.
/etc/inf3r is read-only and holds deploy.toml. The default deploy file
contains the mock manifests path, the container bind, the TCP listener, and the
token path. It does not mount the source tree or any engine library.
The control and its engine containers run as container root 0:0. Under
rootless Docker that root maps to the unprivileged host uid that runs the
daemon, so a host mount must be readable by that uid. A directory made by
mktemp -d is mode 0700 and the server reports cannot read the deploy file: Permission denied; chmod -R a+rX on the mounted tree is the fix. Do not run
the control as a non-root container uid: it would map to a subordinate host uid
and would not satisfy the socket peer check (D28).
Security boundary
The control container is trusted: it holds the rootless Docker socket and can
start any engine. An engine container is not. It gets no Docker socket, no host
cache directory, no blob store, no token, and no network. Its root is read-only,
/tmp is the only writable filesystem besides its private socket instance, and
it runs with --cap-drop ALL and no-new-privileges. Every engine gets
--pids-limit, a host --memory ceiling, a --shm-size, a nofile ulimit, and
json-file log rotation; a bind may lower these. The GPU ledger still governs
device memory. Both the control and the engines run as 0:0; under rootless
Docker that maps to the unprivileged host uid that owns the socket, so peer-uid
authentication still means the same thing.
Only the control reads the deploy file and bundle manifests. Every container
bind needs probe_image: it supplies the sibling's host PID and process memory
even on a CPU-only bind, and for GPUs it asks for nvidia.com/gpu=all so a CDI
subset is not renumbered. An engine still gets only the card its bind names.
Host mode
Container mode is opt-in per bind. A host-mode deployment keeps
runtime = "process" (the default), puts the bundle binary below bin_dir, and
needs neither an image nor socket_host_dir. Both modes can share one deploy
file while a host moves over. To roll back, change runtime to process or
remove the container bind; the bundle id, models, and client API do not change.
The full migration sequence is in .f0rge/wiki/docs/ops.md section 5.4.
Weights and the cache
Weights are content, never a layer. The control grants weight and media
descriptors over Wire 2 and the engine reads /proc/self/fd/<n>; a read-only
asset mount is the other allowed form. The cache is a control resource (D22 and
D23): the engine has no cache directory, quota, or tier, and its cache traffic
crosses the private socket as descriptors.
Run
Build the content-tagged mock image once, so its local alias exists:
./ops/images.sh build mock/x64-cpu
Then start the control:
docker compose up -d --build
docker compose ps
docker compose exec -T inf3r cat /var/lib/inf3r/token
The control starts the mock as a sibling container with no network, a
read-only root, --cap-drop ALL, and only its private socket directory. The
engine container is not a compose service: its lifetime follows the control's
supervisor (D28). docker compose up still uses one state volume, so a second
start keeps the token and the blob store; remove the volume with
docker compose down -v to make a new token.
ops/compose-proof.sh runs the same path, waits for the healthcheck, checks
that the control has no plugin process, restarts it to prove the token and
state survive, and runs the container gate against the same image.
A host that serves another bundle adds its [[node.bind]] section to
docker/config/deploy.toml, adds the bundle manifests below
/opt/inf3r/plugins, and builds the bundle image with ops/images.sh; no
plugin binary is copied into the control image.
Release image
docker/Containerfile.release builds the minimal release image used by the
public hub. It has a scratch runtime with only the three binaries, the glibc
libraries that the host Docker CLI and CDI nvidia-smi need, the licence and
source documents, and an empty deploy template. It has no shell, package
manager, Python, bundle, plugin binary, engine tree, or weight. The default
user is 10000:10000; rootless deployments override it to 0:0 at run time,
as docker/compose.yaml does.
Build and check it locally with:
docker buildx build --load --pull=false -f docker/Containerfile.release \
-t inf3r:release-ci .
docker run --rm --entrypoint /usr/local/bin/inf3r inf3r:release-ci --version
docker/release.lock records the two build-time bases. 15_image_release.sh
builds the image, checks every published layer against the 24 MiB budget,
checks the default user and the three --version outputs, verifies that no
bundle or engine is present, and exercises --init-token without a shell.