TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/chaitu426/minibox/llms.txt
Use this file to discover all available pages before exploring further.
BASE directive is the first thing MiniBox evaluates at the start of every build. It determines the root filesystem that all BLOCK layers are stacked on top of. MiniBox supports four distinct resolver types — OCI registry pull, scratch, local image reference, and local tar archive — selected automatically based on the value you provide.
Resolution Order
WhenBASE <image> is encountered, the builder (internal/builder/builder.go → resolveBaseImage) tries resolvers in the following order:
scratch — skip all resolution
If the value is exactly
scratch, no base filesystem is prepared. The block starts with a completely empty root.Local image — check the OCI index
If the value matches an image name already registered in
DataRoot/index.json (a previously built MiniBox image), that image’s layers are reused directly — no network call required.Local archive — detect .tar / .tar.gz extension
If the value ends in
.tar or .tar.gz and the file exists on disk, MiniBox extracts it into DataRoot/base_layers/ and uses that as the base rootfs.OCI Registry Pull
MiniBox implements the Docker V2 Registry API directly in Go (internal/builder/fetch_oci.go). No Docker daemon is required.
Supported Registries
| Registry | Example BASE value |
|---|---|
| Docker Hub (official) | BASE alpine:latest |
| Docker Hub (namespaced) | BASE library/ubuntu:22.04 |
| GitHub Container Registry | BASE ghcr.io/user/repo:tag |
| Quay.io | BASE quay.io/coreos/etcd:v3.5.0 |
| Any Docker V2 registry | BASE registry.example.com/myimage:1.0 |
registry-1.docker.io for bare image names with no hostname prefix.
Authentication
For registries that require authentication (including Docker Hub for pulling private images), MiniBox follows the standard Bearer token challenge flow:- Send unauthenticated manifest request.
- Receive
401 Unauthorizedwith aWWW-Authenticate: Bearer realm=…header. - Exchange the realm/service/scope details for a short-lived token at the auth endpoint.
- Retry the manifest request with the bearer token in the
Authorizationheader.
MiniBox currently uses anonymous pulls for public images. Private registry credentials are not yet configurable via the CLI. For private images, use a local archive or pre-pulled local image as the base.
Multi-Arch Manifest List Resolution
Modern registries serve manifest lists (OCI Image Index) that contain per-platform entries. MiniBox always resolves tolinux/amd64:
linux/amd64 is not found in the manifest list, MiniBox falls back to the first entry and logs a warning:
Parallel Layer Downloads
MiniBox downloads all layers concurrently, capped at 3 simultaneous connections (maxConcurrentLayerPulls = 3) to avoid overwhelming the registry CDN. Each layer download retries up to 3 times (layerDownloadRetries = 3) with exponential back-off (2 s, 4 s) on transient failures.
Cache Location
Pulled base images are extracted to:<image_tag> is the image reference with : and / replaced by _. For example, node:18-slim is cached at:
DataRoot/base_layers/<image_tag>/bin exists. If it does, the pull is skipped entirely:
Examples
BASE scratch — Static Binary Images
scratch is a special keyword that starts the build with a completely empty filesystem — no shell, no libc, no utilities of any kind. This produces the smallest possible images and is the standard approach for statically linked Go and Rust binaries.
When BASE scratch is used, resolveBaseImage returns empty lower directories and skips all fetching:
Go Static Binary Example
BASE is a top-level directive only — it applies to the whole file, not to individual blocks. Set BASE scratch at the top to start with an empty filesystem for all blocks. The compiler tools needed in a builder block must be installed via RUN from within that empty base, or use a two-file approach where the compiler image is a separate pre-built local image.What to copy into a scratch image
| Artifact | Why |
|---|---|
| Statically linked binary | The application itself — no external library deps |
/etc/ssl/certs/ca-certificates.crt | Required for HTTPS outbound calls |
/etc/passwd (optional) | Only if the binary reads user entries |
| Static asset directories | HTML, templates, or embedded data not baked into the binary |
Local Image Reference
<image-name> in its own DataRoot/index.json, it reuses that image’s layers directly without any network access. This is how you chain MiniBox-built images together.
containerRuntime.ResolveImageLayers and used as the base lower directories for the overlay stack.
Local Archive
.tar or .tar.gz that exists on the host filesystem is treated as a local archive base. This is useful for:
- Importing rootfs images exported from other tools.
- Bootstrapping from a custom-built Alpine/Ubuntu minimal rootfs.
- Offline environments with no internet access.
_) and stored at:
./rootfs.tar.gz is extracted to:
The archive cache does not detect changes to the archive file itself. If you update the archive, run
minibox system prune --build-cache or manually delete the corresponding DataRoot/base_layers/archive_* directory to force a re-extraction.Examples
Summary: Choosing a Base Image Type
OCI Registry
Use when: You want a well-maintained public image (Alpine, Ubuntu, Node.js, Python, Go) as a starting point.
scratch
Use when: Building a statically compiled binary (Go, Rust) that needs no OS utilities at runtime. Produces the smallest possible image.
Local Image
Use when: You have a shared internal base image already built with MiniBox and want to avoid redundant layer re-downloads across many application images.
Local Archive
Use when: Working offline, importing from another tool, or using a custom rootfs that is not available from any OCI registry.