Skip to content

CLI reference

This page gives each command of the boxfork program: the syntax, the flags, the output and the exit status. The page is for a person who controls sandboxes from a terminal or from a script.

One program has all the commands. boxfork serve starts the daemon. boxfork mcp starts the MCP server. The other commands are clients of the HTTP API of a daemon.

Source:

Command Function
boxfork serve [flags] Start the daemon. See configuration.md.
boxfork mcp [flags] Give the sandbox tools to an agent through MCP.
boxfork version Print the version.
boxfork help Print the list of commands.
boxfork create [flags] Create a sandbox and print its identifier.
boxfork ls List the sandboxes.
boxfork exec [flags] <sandbox> <command> [args...] Run a command in a sandbox.
boxfork cp <from> <to> Copy one file into a sandbox or out of a sandbox.
boxfork kill <sandbox>... Kill sandboxes.
boxfork pause <sandbox> Pause a sandbox.
boxfork resume <sandbox> Resume a paused sandbox.
boxfork snapshot <sandbox> Create a snapshot and print its identifier.
boxfork snapshots List the snapshots.
boxfork rmsnapshot <snapshot>... Delete snapshots.
boxfork fork [flags] <sandbox> Fork a sandbox and print the identifiers of the forks.
boxfork mkvolume <name> Create a volume.
boxfork volumes List the volumes.
boxfork rmvolume <volume>... Delete volumes.
boxfork pool [flags] Create a pool, or change the size of a pool.
boxfork pools List the pools.
boxfork rmpool <pool>... Delete pools.
boxfork gpus List the GPUs of the host.
boxfork info Show the properties of the daemon.
  • Write a flag with one hyphen or with two hyphens: -json and --json are the same.
  • Write the value of a flag after a space or after =: --image python:3.12 or --image=python:3.12.
  • A duration has a number and a unit, for example 30s, 10m or 1h30m.
  • Each command accepts -h. It prints the syntax and the flags of the command.
  • For all client commands other than exec, you can put the flags before, between or after the arguments.
  • For boxfork exec, put the flags before the sandbox identifier. See boxfork exec.
  • The argument -- stops the flags. The program does not read a flag after it.

Each client command accepts these flags. boxfork serve, boxfork version and boxfork help do not.

Flag Default Meaning
--url <address> BOXFORK_URL, then http://127.0.0.1:7070 The address of the daemon. An address without http:// or https:// gets http://.
--key <key> BOXFORK_API_KEY, then the key file of a local daemon The API key.
--json off Print the result as JSON, with an indent of two spaces.

--json prints the objects of the HTTP API. http-api.md describes their fields. A list command prints a JSON array of the objects. --json has no effect on exec, cp, kill, rmsnapshot, rmvolume and rmpool.

Variable Read by Meaning
BOXFORK_URL client commands, mcp The address of the daemon when --url is not given.
BOXFORK_API_KEY client commands, mcp The API key when --key is not given.
BOXFORK_DATA_DIR client commands, mcp, serve The data directory. The client reads the key file from it. For serve, it is the default of --data-dir.
BOXFORK_PIN_CERT client commands, mcp A certificate file in PEM format. With it, the client trusts an HTTPS daemon only if the daemon gives exactly this certificate. The client does not examine the name in the certificate.
DOCKER_HOST serve The address of the engine when --docker-host is not given.

The client uses the first of these that has a value:

  1. The --key flag.
  2. The BOXFORK_API_KEY variable.
  3. The file api-key in the data directory. The client reads this file only when the host in the address is localhost, 127.0.0.1 or ::1.

The data directory is BOXFORK_DATA_DIR. Without that variable, it is /var/lib/boxfork for the root user and ~/.boxfork for other users. If the client finds no key, the command stops with an error.

The client sends the key in the Authorization header. The client does not follow a redirect, thus the key goes only to the address that you gave.

Status Meaning
0 The command was successful. -h also gives 0.
1 The command failed. The program prints boxfork: and the error on the standard error output.
2 The command line is wrong: no command, an unknown command, or a flag error in a client command or in mcp.
other boxfork exec returns the exit status of the command in the sandbox. See boxfork exec.

A flag error in boxfork serve gives status 1, not 2. An argument that a command does not accept gives status 1 and the syntax of the command.

A client command stops when it gets the SIGINT signal or the SIGTERM signal.

boxfork version prints the version of the program. boxfork -v and boxfork --version do the same. A build without a version prints dev.

boxfork help prints the list of commands on the standard output. boxfork -h and boxfork --help do the same. boxfork without a command prints the same list on the standard error output and gives status 2.

boxfork create [flags]

This command creates a sandbox and prints its identifier. It accepts no arguments.

Flag Default Meaning
--image <image> The default image of the daemon The image to start from.
--snapshot <id> none A snapshot to start from. Do not give --image with it.
--gpu <n> 0 The number of full GPUs to attach.
--cpus <n> The default of the daemon CPU cores. A fraction is permitted.
--memory-mb <n> The default of the daemon Memory in MiB.
--timeout <duration> The default timeout of the daemon The life of the sandbox, for example 30m. 0 means that the sandbox never ends.
--no-network off Create the sandbox without networking.
--suspend-after <duration> The default of the daemon Suspend the sandbox after this idle time, for example 10m. 0 means never.
--env NAME=value none An environment variable. You can give this flag more than one time.
--volume name:/path[:ro] none A volume to mount. :ro mounts it read-only. :rw is the default. You can give this flag more than one time.

The program sends --timeout and --suspend-after only if you give them. The program examines --env and --volume before it calls the daemon. A wrong value gives status 2.

Terminal window
$ boxfork create --image python:3.12 --timeout 30m --env STAGE=test
sbx_k3v7q2mzj5xw4n6a
$ boxfork create --gpu 1 --memory-mb 16384 --suspend-after 10m --volume models:/models:ro
sbx_t2x7c4mq6va5k3zn

With --json, the command prints the sandbox object.

boxfork ls

This command lists the sandboxes, the oldest first.

Column Meaning
ID The identifier of the sandbox.
IMAGE The image.
STATE running, paused or suspended.
GPUS The number of GPUs and the name of the first one, for example 1 x NVIDIA A100-SXM4-40GB. - for none.
EXPIRES The time that is left, for example in 4m12s. never for a sandbox without a timeout. paused for a paused sandbox. now when the time is at its end.
Terminal window
$ boxfork ls
ID IMAGE STATE GPUS EXPIRES
sbx_k3v7q2mzj5xw4n6a python:3.12 running - in 28m41s
sbx_a6r3n5wq2zk7m4xc ubuntu:24.04 paused - paused

The list does not show the waiting sandboxes of a pool.

boxfork kill <sandbox>...

This command kills one or more sandboxes. The daemon removes each container and all files in it. The command prints the identifier of each sandbox that it killed.

If one sandbox fails, the command continues with the others. Then it prints the errors and gives status 1.

Terminal window
$ boxfork kill sbx_k3v7q2mzj5xw4n6a sbx_a6r3n5wq2zk7m4xc
sbx_k3v7q2mzj5xw4n6a
sbx_a6r3n5wq2zk7m4xc
boxfork pause <sandbox>
boxfork resume <sandbox>

pause stops all processes of a sandbox. The memory stays, and the timeout clock stops. resume continues a paused sandbox. resume also wakes a suspended sandbox.

Each command prints the identifier and the new state. With --json, it prints the sandbox object.

Terminal window
$ boxfork pause sbx_k3v7q2mzj5xw4n6a
sbx_k3v7q2mzj5xw4n6a paused
$ boxfork resume sbx_k3v7q2mzj5xw4n6a
sbx_k3v7q2mzj5xw4n6a running
boxfork exec [flags] <sandbox> <command> [args...]

This command runs a command in a sandbox. It streams the output while the command runs. The standard output of the command goes to the standard output of the program. The standard error output of the command goes to the standard error output of the program.

Flag Default Meaning
--cwd <dir> The default of the sandbox The directory in which the command runs.
--timeout <duration> 0 Kill the command after this time. 0 means no time limit.
--stdin off Send the standard input of the program to the command.
--env NAME=value none An environment variable for this command. You can give this flag more than one time.

Rules:

  • Put all flags before the sandbox identifier. This includes --url and --key.
  • All text after the sandbox identifier is the command. The program does not read flags there.
  • If -- comes immediately after the sandbox identifier, the program drops it.
  • One argument after the sandbox identifier is a command line for the shell. Pipes and && work.
  • More than one argument is a program with its arguments. The sandbox runs them directly, without a shell.
  • With --stdin, the program reads all of its standard input before it sends the command.
Terminal window
$ boxfork exec sbx_k3v7q2mzj5xw4n6a python3 -c 'print(6 * 7)'
42
$ boxfork exec sbx_k3v7q2mzj5xw4n6a 'ls /etc | wc -l'
94
$ boxfork exec --cwd /work --timeout 5m --env STAGE=test sbx_k3v7q2mzj5xw4n6a -- make test
$ echo 'print("from stdin")' | boxfork exec --stdin sbx_k3v7q2mzj5xw4n6a python3 -
from stdin

The exit status of boxfork exec:

Result of the command Exit status Message on the standard error output
Exit code 0 0 none
A different exit code That exit code none
The time limit killed the command 124 boxfork: the command was killed when its timeout ran out
A signal ended the command 1 boxfork: the command was ended by signal and the name of the signal
The sandbox cannot start the command 1 boxfork: the command could not be started: and the reason
The daemon refused the request, or the connection ended 1 boxfork: and the error
boxfork cp <from> <to>

This command copies one file. One side is a file on your machine. The other side is a file in a sandbox. Write the sandbox side as <sandbox>:<absolute path>.

Into a sandbox:

  • The source must be a file. The command does not copy a directory.
  • If the target path ends with /, the command adds the name of the source file.
  • The file in the sandbox gets the permission bits of the source file.
  • The helper creates the directories of the target path if they do not exist.

Out of a sandbox:

  • If the target is a directory on your machine, the file goes into it with its own name.
  • The copy gets the permission bits of the file in the sandbox, less your umask.
  • The command writes a temporary file adjacent to the target and then renames it.
  • If the download stops before the end, the command leaves the target as it was and gives status 1.
Terminal window
$ boxfork cp ./data.csv sbx_k3v7q2mzj5xw4n6a:/work/data.csv
$ boxfork cp ./run.sh sbx_k3v7q2mzj5xw4n6a:/work/
$ boxfork cp sbx_k3v7q2mzj5xw4n6a:/work/result.json ./out/

The command prints nothing when it is successful.

boxfork snapshot <sandbox>

This command saves the files of a sandbox as a snapshot and prints the identifier of the snapshot. With --json, it prints the snapshot object. The command has no flag for metadata.

Terminal window
$ boxfork snapshot sbx_k3v7q2mzj5xw4n6a
snap_p4c6w2yzr7mq3b5d
$ boxfork create --snapshot snap_p4c6w2yzr7mq3b5d
sbx_m4q7z2xk5wa3n6rc
boxfork snapshots

This command lists the snapshots, the oldest first.

Column Meaning
ID The identifier of the snapshot.
FROM The sandbox that the snapshot came from.
IMAGE The image of that sandbox.
CREATED The time of creation, in the time zone of your machine.
Terminal window
$ boxfork snapshots
ID FROM IMAGE CREATED
snap_p4c6w2yzr7mq3b5d sbx_k3v7q2mzj5xw4n6a python:3.12 2026-12-05 10:18
boxfork rmsnapshot <snapshot>...

This command deletes one or more snapshots and prints the identifier of each deleted snapshot. The daemon refuses to delete a snapshot while a sandbox or a pool uses it. If one snapshot fails, the command continues with the others. Then it prints the errors and gives status 1.

Terminal window
$ boxfork rmsnapshot snap_p4c6w2yzr7mq3b5d
snap_p4c6w2yzr7mq3b5d
boxfork fork [flags] <sandbox>

This command makes new sandboxes with the files of a sandbox that runs. It prints one identifier on each line. The forks have the files of the original sandbox. They have none of its processes.

Flag Default Meaning
-n <n> 1 The number of forks. The maximum is 64.
--count <n> 1 The same as -n.
--gpu <n> The number of GPUs of the original sandbox The GPUs of each fork. 0 gives forks without a GPU.
--timeout <duration> The default timeout of the daemon The life of each fork.
Terminal window
$ boxfork fork --count 3 sbx_k3v7q2mzj5xw4n6a
sbx_a6r3n5wq2zk7m4xc
sbx_t2x7c4mq6va5k3zn
sbx_w5z3k7nq2xm6c4ra

With --json, the command prints the identifier of the temporary snapshot and the sandbox objects. If the daemon cannot create all forks, it creates none.

boxfork mkvolume <name>

This command creates an empty volume and prints its name. With --json, it prints the volume object. A name has 1 to 63 characters: lower-case letters, digits, ., _ and -. The first character is a letter or a digit.

Terminal window
$ boxfork mkvolume data
data
$ boxfork create --volume data:/data
sbx_k3v7q2mzj5xw4n6a
boxfork volumes

This command lists the volumes in the sequence of their names.

Column Meaning
NAME The name of the volume.
CREATED The time of creation, in the time zone of your machine.
MOUNTED BY The sandboxes that mount the volume. - for none. For a default volume of the daemon, the text every new sandbox, at and the path.
Terminal window
$ boxfork volumes
NAME CREATED MOUNTED BY
data 2026-12-05 10:40 sbx_k3v7q2mzj5xw4n6a
models 2026-12-04 08:02 every new sandbox, at /models
boxfork rmvolume <volume>...

This command deletes one or more volumes and all their contents. It prints the name of each deleted volume. The daemon refuses to delete a volume while a sandbox mounts it. If one volume fails, the command continues with the others. Then it prints the errors and gives status 1.

Terminal window
$ boxfork rmvolume data
data
boxfork pool [flags]

This command creates a pool and prints its identifier. The daemon then keeps --size sandboxes started. If a pool with the same image or snapshot, CPU cores, memory and network exists, the command changes its size.

Flag Default Meaning
--image <image> The default image of the daemon The image of the sandboxes.
--snapshot <id> none A snapshot to start from. Do not give --image with it.
--size <n> 0 The number of sandboxes to keep. You must give a number of 1 or more.
--cpus <n> The default of the daemon CPU cores of each sandbox.
--memory-mb <n> The default of the daemon Memory of each sandbox in MiB.
--no-network off Keep sandboxes without networking.
Terminal window
$ boxfork pool --image python:3.12 --size 8
pool_h5n2x7tva3kq6m4c
$ boxfork pool --image python:3.12 --size 4
pool_h5n2x7tva3kq6m4c

The second command changes the size of the same pool. With --json, the command prints the pool object.

boxfork pools

This command lists the pools, the oldest first.

Column Meaning
ID The identifier of the pool.
FROM The image or the snapshot of the sandboxes.
CPUS CPU cores of each sandbox.
MEMORY Memory of each sandbox.
NETWORK yes or no.
READY The number of waiting sandboxes and the size of the pool, for example 8/8.
PROBLEM The reason why the daemon did not start the last sandbox. - for none.
Terminal window
$ boxfork pools
ID FROM CPUS MEMORY NETWORK READY PROBLEM
pool_h5n2x7tva3kq6m4c python:3.12 2 1024 MiB yes 8/8 -
boxfork rmpool <pool>...

This command deletes one or more pools and their waiting sandboxes. It prints the identifier of each deleted pool. Sandboxes that the daemon handed out from a pool stay. If one pool fails, the command continues with the others. Then it prints the errors and gives status 1.

Terminal window
$ boxfork rmpool pool_h5n2x7tva3kq6m4c
pool_h5n2x7tva3kq6m4c
boxfork gpus

This command lists the GPUs of the host. On a host without a GPU, it prints This host has no GPUs.

Column Meaning
INDEX The index of the device.
MODEL The model name.
MEMORY The memory of the device.
USED BY The sandbox that holds the device, or one of the texts below.
Text in USED BY Meaning
- The device is free.
a sandbox identifier That sandbox holds the device.
a sandbox identifier and (not answering) That sandbox holds the device, and the driver does not list the device.
nobody: not answering No sandbox holds the device, and the driver does not list it.
another program A program that is not boxfork uses the device.
- (the last sandbox given it could not use it) The device is free, and the last sandbox that got it failed the GPU check.
Terminal window
$ boxfork gpus
INDEX MODEL MEMORY USED BY
0 NVIDIA A100-SXM4-40GB 40960 MiB sbx_k3v7q2mzj5xw4n6a
1 NVIDIA A100-SXM4-40GB 40960 MiB -
boxfork info

This command shows the properties of the daemon. With --json, it prints the object of GET /v1/info.

Line Meaning
daemon The address and the version of the daemon.
engine The type and the version of the engine.
isolation gvisor or container.
sandboxes kept apart on the network yes if the engine blocks traffic between sandboxes.
sandboxes kept from the cloud metadata service yes if the firewall rule is in position.
snapshot and fork yes if snapshots work on this host.
GPUs The number of GPUs on the host.
sandboxes The number of sandboxes.
Terminal window
$ boxfork info
daemon http://127.0.0.1:7070 (version 0.1.0)
engine docker 29.1.0
isolation gvisor
sandboxes kept apart on the network yes
sandboxes kept from the cloud metadata service yes
snapshot and fork yes
GPUs 0
sandboxes 2
boxfork mcp [flags]

This command is an MCP server on its standard input and standard output. It calls the daemon through the HTTP API. It accepts flags only. A word that is not a flag stops the command with exit status 1. The command does not read a flag after that word. mcp-and-tools.md describes the protocol, the tools and the session rules.

Flag Default Meaning
--url <address> BOXFORK_URL, then http://127.0.0.1:7070 The address of the daemon.
--key <key> BOXFORK_API_KEY, then the key file of a local daemon The API key.
--image <image> The default image of the daemon The image of the sandbox that the session creates for itself.
--gpu <n> 0 The number of GPUs of that sandbox. A negative number is an error.
--idle-timeout <duration> 30m Kill a sandbox of the session after this time without use. The value must be more than zero.
--max-sandboxes <n> 16 The maximum number of sandboxes of the session at one time. 0 means no limit.
--keep off Do not kill the sandboxes of the session when the session ends.

The command writes its log on the standard error output. The standard output has only the protocol.

Terminal window
boxfork mcp --image python:3.12 --idle-timeout 1h
boxfork serve [flags]

This command starts the daemon. It accepts flags only. configuration.md gives each flag, the data directory and the service files.

The CLI does not have a command for each route of the HTTP API. These operations are not in the CLI:

  • get one sandbox by its identifier
  • set a new timeout for a sandbox
  • list, describe, remove or rename files, and make a directory
  • copy a directory
  • give metadata to a sandbox, a snapshot or a fork
  • ask for a GPU by model or by memory

Use the Python SDK or the HTTP API for these operations.