MiniBox ships a dedicatedDocumentation 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.
db run subcommand that wraps the standard container runtime with a set of production-friendly defaults tuned for database engines. It mounts a larger shared memory segment, ensures a full POSIX device environment, raises the I/O scheduling priority, and protects the process from the OOM killer — all while persisting data to a named volume that survives container restarts.
What db run does differently from run
minibox db run passes db_mode=true in the ContainerOptions struct, which unlocks a different code path in the container child process. The table below summarises every behavioural difference:
| Feature | minibox run | minibox db run |
|---|---|---|
| Capability drop | ✅ Dropped before exec | ❌ Skipped (db_mode=true) — DB entrypoints need chown on first boot |
/dev/shm size | 256 MB (default) | Configurable via --shm-size (default 256 MB) |
/dev/pts (devpts) | Mounted | Mounted — required by initdb and DB shell tools |
/tmp tmpfs | Mounted as tmpfs with mode 1777 | Mounted as tmpfs with mode 1777 |
| Device nodes | null, zero, random, urandom, full, tty, console, ptmx | null, zero, random, urandom, full, tty, console, ptmx |
io.weight cgroup | 100 (default) | 800 — high disk scheduling priority |
oom_score_adj | 0 (default) | -900 — last process to be OOM-killed |
| Named volume | None | Persistent volume at DataRoot/volumes/<name>-data |
| Detached mode | Optional (-d) | Always detached |
Why capabilities are kept in db_mode
On first boot, database engines such as PostgreSQL’s initdb and MongoDB’s mongod need to chown their data directories and create socket files in locations that require privilege. Dropping all capabilities before exec (as the standard run path does) breaks this initialisation sequence. db_mode=true skips dropContainerCapabilities() so the entrypoint runs with a full capability set. Future versions of MiniBox aim to replace this broad exception with a narrower set of kept capabilities.
/dev/shm and shared memory
/dev/shm is mounted as a tmpfs inside every container. In db run, the size is controlled by --shm-size:
- PostgreSQL uses
shared_buffersbacked by/dev/shm; a minimum of 128 MB is recommended. - MongoDB WiredTiger benefits from 256 MB or more.
- Redis has minimal shared memory requirements; 64 MB is sufficient.
mode=1777,size=<N>m with MS_NOSUID | MS_NODEV | MS_STRICTATIME flags.
Named volumes
db run requires a named volume so database files persist when the container is stopped and restarted. Volumes are stored on the host at:
DataRoot is /var/lib/minibox. Override it with MINIBOX_DATA_ROOT.
The volume is bind-mounted into the container at the path specified by --data. MiniBox creates both the host directory and the container mount target (os.MkdirAll) before the container starts.
Flags reference
Named volume identifier. The volume is stored at
DataRoot/volumes/<name>-data/ on the host. If omitted, a name is derived from the image name.Container-side path where the named volume is mounted. Set this to the path your database engine writes its data files (e.g.
/var/lib/postgresql/data for Postgres).Size of
/dev/shm in megabytes. Increase for databases that use large shared memory buffers.Port mapping in
host:container format. Repeat for multiple ports. See Networking for details.Environment variable in
KEY=VALUE format. Repeat for multiple variables. Used to pass credentials and configuration to the database entrypoint.Shell command string passed to
/bin/sh -c <cmd> when no positional arguments are provided. Useful for wrapping entrypoints that require shell expansion.Always detached. Accepted for symmetry with
minibox run -d but has no additional effect — db run is always detached.Examples
- PostgreSQL
- MongoDB
- Redis
db-test/postgres/run.sh in the MiniBox repository.Inspecting and managing database containers
Becausedb run is always detached, use the standard lifecycle commands to manage it:
Removing a container with
minibox rm only deletes the container record and its overlayfs layers. The named volume directory at DataRoot/volumes/<name>-data/ is not deleted and can be reused by a new db run invocation with the same --name.Limitations
- Experimental status — The
db runpath is explicitly marked experimental. Not all database engine versions or distributions have been tested. - Capabilities exception is broad —
db_mode=trueskips all capability drops. A future release will keep only the minimum required capabilities (CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_SETUID,CAP_SETGID). - Some kernels need a fuller
/dev— PostgreSQLinitdbon some kernel versions requires real device nodes (/dev/null, etc.) to be character devices rather than bind mounts. On kernels that denymknodinside the container, MiniBox falls back to bind-mounting from the host/dev, which may not always succeed. - No cgroup memory reservation —
db rundoes not currently setmemory.low(a soft memory guarantee). Databases competing for memory on a busy host may be subject to aggressive reclaim. - Single-host only — MiniBox has no cluster networking. Database containers are always single-instance and accessible only from the same host.