--conf. See configuration precedence for global defaults.
Common image, resource, lifecycle, environment, policy, secret, script, and patch fields work everywhere. Host-integrated networking, local rootfs forms, snapshots, replace behavior, and several runtime fields are unavailable on microsandbox cloud.
Sparse configuration
Required fields are checked after merging files and CLI arguments. For example, supply the image separately from a network-only file:Scoped config files
Scoped files contain one group of settings without its wrapper key. Unrelated fields are rejected.
For example,
--net-conf expects this unwrapped document:
network: {...} to --net-conf is an error; use --conf for a
root-shaped document.
Combining files
Root and scoped configuration flags are repeatable and may be interleaved. The CLI applies each file from left to right, then applies explicit flags and positional arguments. See Precedence and Merge precedence for the complete resolution rules.--net-conf cannot be combined with --net, --no-net, --net-rule, or --net-default*. When network policy is loaded through a root --conf file instead, a policy CLI flag replaces it, while --net-rule remains additive and is evaluated before rules loaded from the file.
patch_files are resolved against that patch file.
Rust applications can apply the same sparse configuration model without loading YAML. See SandboxBuilder::overlay for the typed API, merge behavior, and migration from the earlier patch types.
Schema
Image and registry
The common image form is a string. Local paths beginning with., .., or / are resolved as bind roots or disk images; other strings are OCI references.
Resources and lifecycle
hard is omitted it equals soft.
Runtime
cmd is the default workload for msb run. msb create stores it without launching it.
Mounts
A string mount is a config-relative bind mount using the sameSOURCE:TARGET[:OPTIONS] option grammar as a bind passed to -v/--volume. Options include ro, rw, noexec, nosuid, nodev, follow-root-symlinks, stat-virt=strict|relaxed|off, host-perms=private|mirror, quota=<size>, and paired uid=<N>,gid=<N>:
target:
readonly, noexec, nosuid, and nodev. stat_virtualization, host_permissions, and paired uid/gid apply only to bind and directory-backed named mounts. Ownership changes only the guest fallback for files without a per-file stat override; it does not change host inode ownership. Duplicate guest targets are rejected.
Rootfs patches
Patch files run first in listed order, followed by inline patches:patches list using the same operations. File modes must be quoted four-digit octal strings.
Network
Use a preset string for the common cases:public, the default, permits public internet access while blocking private, loopback, link-local, and metadata destinations. none denies ingress and egress. open is unrestricted.
The object form adds rules and network services:
allow list implies deny-by-default egress. strict defaults to true and requires hostname-based allow rules to use an inspectable request authority. Plain HTTP exposes that authority in Host; HTTPS only exposes it when TLS interception is enabled and not bypassed. Without that visibility, strict mode denies HTTPS that would otherwise be allowed only by a hostname rule. Set strict: false to opt out. Top-level ports is shorthand for network.ports; when both are present, the lists are combined and duplicate host ports are rejected.
Secrets
Every secret requires a non-empty destination allowlist. Whenvalue is omitted, the host environment variable with the same name is used. An exact ${NAME} value records NAME as the host-side source instead of copying its plaintext into durable config.
substitution controls headers, query parameters, and request bodies independently; it defaults to headers only, and Basic authentication follows the header setting. Disabled locations still block the placeholder unless the destination appears in passthrough. secret_violation_action sets the sandbox-wide blocking action, while a per-secret violation_action overrides it. Declaring a secret enables TLS interception and DNS-rebind protection.
Scripts
Scripts are named shell snippets installed as executables in/.msb/scripts, which is on PATH. The sandbox configuration’s shell selects their shebang and defaults to /bin/sh.
Validation
Sandbox configuration is data, not a templating language. The loader rejects unknown fields, duplicate keys, multiple YAML documents, anchors, aliases, merge keys, and custom tags. Bare YAML 1.1 booleans such asyes, no, on, and off are rejected. Quote modes, sizes, durations, ports, domains, image references, and other typed strings.
Only ${NAME} environment substitution is supported. Substituted variables must exist when the config is loaded; an exact secret value: "${NAME}" is the exception because it records a host-side source that is resolved when the sandbox starts. Shell-style operators such as ${NAME:-fallback}, includes, templates, loops, and expressions are not supported.
Project envelope fields such as sandboxes, volumes, and layers, plus per-project fields such as depends_on, are rejected in single-sandbox configuration.
UDP session limit
Setmax_udp_connections in the network configuration, or pass --max-udp-connections 512. The default is unlimited in single-tenant mode and 1,024 relay sessions in multi-tenant mode; zero explicitly selects unlimited. At capacity, new sessions evict the least recently active session.
max_connections and --max-connections remain deprecated TCP-only aliases for max_tcp_connections and --max-tcp-connections. Specifying both TCP names in one configuration or command is an error. The UDP limit is independent.