MiniBox supports basic container health checks defined directly in yourDocumentation 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.
MiniBox build file. A health check is a shell command that MiniBox runs periodically inside the container’s namespaces to determine whether the workload is responding correctly. The result is reflected in the HEALTH column shown by minibox ps.
Defining a health check
Add aHEALTHCHECK directive to your MiniBox file:
Syntax
How often (in seconds) to run the health check command. Must be a positive integer. If omitted, the default is 30 seconds.
The command to run inside the container. It is executed as
/bin/sh -c <joined command>. An exit code of 0 means healthy; any non-zero exit code means unhealthy.How health check metadata is stored
Duringminibox build, the MiniBox parser reads the HEALTHCHECK line and stores the command and interval as OCI image config labels:
| OCI label | Content |
|---|---|
mini.healthcheck.cmd | Command parts joined with the \x1f (unit separator) byte |
mini.healthcheck.interval | Interval in seconds as a decimal string |
save/load and are read back by the runtime without any separate metadata file.
Health monitor goroutine
Whenminibox run starts a container whose image config contains mini.healthcheck.cmd, the runtime spawns a dedicated goroutine (startHealthMonitor) that:
Sets initial state to 'starting'
UpdateContainerHealth(containerID, "starting") is called immediately, before the first check fires. This prevents a race where ps shows none briefly after start.Ticks at the configured interval
A
time.Ticker fires every interval seconds (default 30). On each tick the goroutine verifies that the container is still running and has a valid PID — if not, the goroutine exits cleanly.Runs the check via nsenter
The check command is executed on the host using This enters all five namespaces (mount, UTS, network, IPC, PID) of the container process, so the command runs with the container’s view of the filesystem, hostname, network, and process tree.
nsenter:Health states
| State | Meaning | When set |
|---|---|---|
starting | Container is running but no check has completed yet | Immediately on container start, when a healthcheck is defined |
healthy | Most recent check exited with code 0 | After each passing nsenter run |
unhealthy | Most recent check exited non-zero | After each failing nsenter run |
none | No healthcheck defined in the image, or container has exited | No mini.healthcheck.cmd label; or on container exit |
none by MarkContainerExited().
Viewing health status with minibox ps
The HEALTH column appears in all ps output:
minibox ps -a to include stopped containers.
Examples
Limitations
MiniBox’s health check implementation provides basic liveness signalling. It is not full Docker
HEALTHCHECK parity.HEALTHCHECK spec are not yet implemented:
--start-period— There is no initial grace period during which failures are ignored. All checks after the first tick count toward the health state.--retries— There is no retry counter. A single failed check immediately sets the state tounhealthy; a single passing check immediately sets it tohealthy.--timeout— Individual check executions do not have a per-run timeout. A hanging check command will block the monitor goroutine for that tick.- Shell form vs exec form — MiniBox always runs the health check as
/bin/sh -c <cmd>. The exec form (JSON array syntax) is not supported.