Skip to main content
Use the short form, such as msb run. msb sandbox run and msb sbx run accept the same arguments. Aliases include ls, ps, rm, cp, and mod. See SSH, Snapshots, and CLI management for other commands.

msb run

Create a sandbox and run its image command. Arguments after -- replace CMD but preserve ENTRYPOINT. Unnamed sandboxes are removed when the command finishes; named sandboxes persist.
Common flags: Use msb run --help for the full flag list. Pass configuration files explicitly. Files merge left to right; explicit CLI arguments override them. See Configuration.

Flat OCI rootfs

Use a complete ext4 root instead of the default layered root. Each sandbox gets a private copy of the cached base.
Pre-pulling is optional. Clone modes: auto tries native copy-on-write then sparse copy; copy forces a portable copy; reflink requires native clone support. Flat roots support pre-boot patches and local snapshots. Patches change only the private disk; snapshots preserve its layout. Set sandbox_defaults.oci.root_disk to use flat roots by default. See storage optimization.

Published ports

Ports bind to 127.0.0.1 by default. Use an explicit address to expose them beyond localhost. Windows may prompt for firewall access.

VSock

Use the repeatable --vsock HOST_PATH:PORT[/stream|/dgram] flag to expose a host Unix socket or local Windows named pipe on guest host CID 2. Stream is the default. Datagram routes preserve message boundaries and are unavailable on Windows. See Host sockets for guest connection details, limits, and SDK examples.

Network profiles

--net is repeatable and accepts comma-separated profiles. public, private, and host compose; DNS through the sandbox gateway is enabled automatically and only once. all and none are terminal policies and cannot be mixed with the three positive profiles.
Explicit --net-rule entries are evaluated before profile-generated rules, so they can narrow or deny part of a profile. --net conflicts with --no-net and the --net-default* flags because those select a different policy baseline.

Outbound proxy

Use --proxy with msb run or msb create to configure one SOCKS proxy:
SOCKS4 supports TCP; SOCKS5 also supports non-DNS UDP. SOCKS5 authentication requires both flags and reads the password from the host environment at startup. Proxy URLs cannot contain credentials, paths, queries, or fragments. See Proxies.

Network rule syntax

--net-rule takes one or more comma-separated rule tokens. The token grammar is:
Targets Quote rule values so the shell does not interpret wildcard characters. Common compositions

msb create

Create and boot a sandbox without running a command. Takes the same flags as msb run (except --detach).

msb snap restore

Restore into a new sandbox. Disk snapshots boot fresh; full snapshots resume execution. Cloud supports disk restore. Use msb exec to run new commands. The existing msb restore, msb sandbox restore, and msb sbx restore forms accept the same flags.
Progress is shown by default. Memory preparation has no fixed timeout and does not consume the activation timeout. Full restore must keep captured CPU and memory settings and cannot apply a guest security profile. Use --disk-only to change them. Network flags replace the destination policy. --net-rule requires --net-default or --no-net; omitting all policy flags keeps configured defaults. Restore requires a new name and does not accept a startup command. Restore and branch do not reuse host resources by default. Map directories with -v /host/path:/guest/path, select a private captured disk with -v /guest/path, and publish new listeners with -p HOST:GUEST. Full restore refuses missing external filesystems and additional disks unless --allow-missing-resources is explicit. Opting out leaves those devices unavailable: backend I/O returns errors, although data cached in guest RAM may remain readable. Disk errors can abort a guest filesystem journal or make it read-only. Warnings remain visible with --quiet. --external-mount-policy relaxed permits supported stale-object mismatches; it does not waive missing backing. --dangerously-inherit-resources authorizes validated source-local bindings, not missing ones. Direct branching retains its existing unavailable-resource behavior. Root and owned storage are always reconstructed; the opt-out cannot waive corrupt or missing snapshot data. Custom vsock routes are not inherited; use --vsock HOST_PATH:PORT to authorize a service for clients to reconnect to.

msb start

Resume a stopped sandbox. Name one or more sandboxes, or select them by label.

msb stop

Stop waits until shutdown completes, with no default timeout. A timeout fails without killing; a dispatched stop may still finish later. Zero expires before dispatch. Paused or unreachable sandboxes return an error; resume or force-stop them. --force kills immediately and may lose unsynced writes.

msb pause / resume

Suspend a resident sandbox without creating a snapshot, then resume it. These operations also accept the top-level msb pause and msb resume forms.
pause --guest-flush required flushes captured persistent filesystems before pausing, so a later disk snapshot can reuse that boundary without resuming. The default auto and explicit skip omit optional writeback; mandatory storage barriers remain. An already-paused VM without the required flush fails rather than resuming implicitly. resume has no flush option. See guest filesystem flush.

msb branch

Create a local child from running or paused execution without saving a snapshot. Memory is shared through copy-on-write; each child’s writes stay private.
Use --names to capture once and start several independent children from the same state:
Both branch forms accept --guest-flush auto|required|skip. Auto and skip preserve dirty memory without flushing root or owned block filesystems; required adds writeback. Host-backed directory synchronization and host disk barriers remain in effect. Volume, port, user, vsock, inheritance, and mount-policy flags match restore. Batch branching captures once. Results follow input order; failed children produce a nonzero exit status without removing successful ones.

msb restart

Stop and start one or more sandboxes. Running, draining, and paused sandboxes are stopped first, then started from their persisted configuration. Stopped, crashed, and created sandboxes skip the stop phase and are started directly.
msb restart --force kills immediately. Otherwise --timeout bounds graceful completion; expiry fails without killing or starting a replacement. Unlike standalone Stop, Restart retains its explicit default budget of ten seconds.

msb wait

Wait for an existing sandbox to reach Stopped or Crashed. Also available as msb sandbox wait and msb sbx wait. Use msb run --name worker --detach … to keep the sandbox available for a later msb wait; unnamed runs are removed when they finish.
The timeout covers lookup and waiting. It returns an error without stopping the sandbox. Missing sandboxes return an error; stopped or crashed sandboxes return immediately. A successful wait means the sandbox stopped or crashed, not that its workload succeeded. Text output shows the sandbox name and status. JSON includes name, status, terminal, exit_code, signal, observed_at, and source. Exit codes and signals are currently unavailable (null); observed_at records when the terminal state was observed.

msb ping

Check whether running sandboxes respond. Add --touch to refresh the idle timer on success.

msb touch

Refresh the idle timer for one or more running sandboxes.

msb modify

msb mod is a shorter alias for msb modify. Change a running sandbox’s configuration. Every change is planned and applied all-or-nothing. CPU and memory resize live within the max_cpus / max_memory ceilings; other changes that can’t apply live need --restart or --next-start.
Like create/run, modify accepts -c/--cpus, -m/--memory, -e/--env, and -w/--workdir. Set --max-cpus and --max-memory at creation to leave room for live growth. They default to the initial CPU and memory allocation; increasing the ceilings requires a restart. Resize can take time. The output and JSON resize_status report applied, converging, guest-refused, or failed. With guest-refused, the host still enforces the new limit. Env and workdir changes on a running sandbox apply to future execs only; running processes keep their current environment. The plan reports this as a warning. --secret reads the same-named host environment variable; inline values are rejected. Options are query, body, no-headers, and passthrough=HOST or passthrough=[HOST,...]. Repeated declarations merge. See secret updates. See live changes for resize behavior. Use msb modify --help for the full flag list.

Compaction

Merge sealed layers in the local root and owned disks. Run separately from configuration changes; the sandbox must be running or fully stopped.
The writable layer is excluded. Fewer than two sealed layers or no eligible disks means no change. See compaction recovery before applying.

msb exec

Execute a command inside a sandbox. An already-running sandbox stays running. Stopped or crashed sandboxes start temporarily and stop again before the command returns, including after execution errors. Invalid environment, resource-limit, or timeout arguments fail before startup.
The CLI auto-detects whether stdin is a terminal. When interactive, msb exec uses attach mode (TTY, line editing). When piped, it captures output. Use --no-tty to force captured, non-interactive execution even from a terminal.

msb copy

Copy files between the host and a sandbox.
Supports host-to-sandbox, sandbox-to-host, and copies within or between sandboxes. Stopped sandboxes start temporarily, as with msb exec. Alias: msb cp.

msb logs

Read output from running or stopped local sandboxes. On cloud, use --follow to stream a running sandbox; historical reads and time filters are unavailable.
The s field in JSON output identifies the source:
If startup failed, logs include the failure stage and a troubleshooting hint.

msb list

List all stored sandboxes.

msb status

Show sandbox status with process details.
CPUS and MEM show current allocation / maximum resize capacity. For measured usage, use msb metrics.

msb metrics

Show live CPU, memory, disk, network, and optional upper disk metrics for running sandboxes.
Limits reflect live resizes. One-shot output samples twice to calculate rates. JSON and follow output keep cumulative counters and include state and cpus.

msb inspect

Show detailed configuration and status.

msb remove

Remove one or more sandboxes and their associated state.

CLI management

See CLI management for installation, updates, diagnostics, and command aliases.