Prerequisites
- A working BoxLite install (Python
boxliteor Node@boxlite-ai/boxlite) and a machine with hardware virtualization — see Installation. - The target image registry is reachable from your machine; for a private registry, have credentials ready (username/password or bearer token).
How it works
When you create a box with a “non-fully-qualified” reference (such asimage="alpine"), BoxLite must resolve it to a full reference (such as
docker.io/library/alpine:latest).
- With no registries configured, the default is
docker.io(Docker Hub). - With
image_registriesconfigured, BoxLite tries each registry that hassearch=Truein list order, and the first success wins; if all fail, it raises. - A fully-qualified reference (such as
quay.io/prometheus/prometheus:v2.40.1) always skips the lookup list and pulls directly from that registry. - The SDK reads no local state: it does not automatically read any local config file. The registry list is supplied entirely by your code, so behavior is deterministic and does not depend on the host machine’s environment.
Quick Example
The simplest flow: have BoxLite checkghcr.io first, then fall back to
docker.io, then create a box with alpine and run a command. You can copy and
run it directly.
Private / authenticated registries
A private registry takes credentials viaImageRegistry’s username/password
(Basic auth) or bearer_token (Bearer auth) fields. Username and password
must be provided together; supplying only one raises.
username/password with bearer_token:
auth sub-object, unlike Python’s flat fields.
Parameters and Returns
boxlite.Options (Python)
After construction, pass it to
boxlite.Boxlite(options) to get a runtime handle
(a synchronous context manager).
boxlite.ImageRegistry (Python)
Constructor signature:
ImageRegistry(host, transport="https", skip_verify=False, search=False, username=None, password=None, bearer_token=None)
JsImageRegistry (Node)
Returns / behavior
Tip:box.exec(...)does not raise when a command exits with a non-zero code; it returns anExecResult(Python fieldsexit_code/stdout/stderr; NodeexitCode/stdout/stderr). Only image-level failures (pull/auth) raise.
Troubleshooting
transport is not a string literal
A common mistake is passing a boolean or an uppercase form. transport only
accepts "https" or "http":
transport="http" or transport="https"
(defaults to https, can be omitted).
host was written as a URL
host must be host[:port]; it cannot have a protocol prefix or a path:
RuntimeError: image registry host is required.
Only a username was given (or only a password)
The two Basic auth fields must be paired:username and password; if using token auth, switch to
bearer_token (Python) / auth.bearerToken (Node), and do not mix them.
A registry is configured but pulls still go to Docker Hub / the image is not found
The most common cause is not settingsearch=True. This field defaults to
False, and a registry that is False does not participate in
non-qualified-name lookup:
Self-signed / internal HTTPS certificate verification fails
An internal self-signed certificate causes TLS verification to fail. For a trusted internal registry you can setskip_verify=True (Python) /
skipVerify: true (Node). This disables certificate and hostname verification,
so only use it when you trust the network. For a plaintext HTTP registry,
switch to transport="http" instead.
Image pull failure raises a standard exception, not BoxliteError
A missing command or an image pull failure raises a standard RuntimeError (Python) / bare Error (Node), not BoxliteError. See Error Handling.
Box fails to start: environment has no virtualization
BoxLite runs inside a microVM and needs hardware virtualization:- Linux: needs KVM (
/dev/kvmaccessible; on WSL2 the user must be in thekvmgroup). - macOS: via the built-in virtualization stack (Apple Hypervisor.framework), no
/dev/kvmrequired. - Without virtualization, startup fails (the exception is catchable; the process does not crash).
image="alpine:latest" (default Docker Hub),
then debug the registry configuration.
Related pages: Error Handling

