Skip to content

Installation

fastsandbox is a client. It does not run sandboxes itself: it drives them by talking to sandboxd, the daemon of Docker Sandboxes, through its Unix socket. Docker Sandboxes is therefore installed first, on the machine where your programs run, then the package. This page covers both, and how to check that the package reaches the daemon.

direction: down
program: "Your program\nwith fastsandbox"
cli: "sbx\nthe CLI of Docker Sandboxes"
daemon: "sandboxd\nthe daemon of Docker Sandboxes" {shape: hexagon}
sandboxes: "Sandboxes\nmicroVMs" {style.multiple: true}
program -> daemon: Unix socket
cli -> daemon
daemon -> sandboxes

Requirements

  • Docker Sandboxes, installed and its daemon running for the current user: sbx version answers. Linux or macOS.
  • fastsandbox talks to the daemon through its socket alone: it forges the kits it needs without the sbx CLI. The CLI, installed with Docker Sandboxes, is used only for a kit that it alone resolves, when asked (KitCache(sbx="sbx")).
  • Python 3.12 or newer (3.12, 3.13 and 3.14 are tested); uv python install 3.14 installs one.
  • To build from source: a Rust toolchain (1.88 or newer) and uv.

Install Docker Sandboxes

fastsandbox neither ships nor installs Docker Sandboxes: install it with the Docker documentation, then check, as the user that will run your programs, that it answers:

sbx version

The daemon runs for that user, and its socket lies in their state directory, $XDG_STATE_HOME/sandboxes/sandboxes/sandboxd/sandboxd.sock or the same path under ~/.local/state: that is where fastsandbox looks for it (see Where the socket is).

Without Docker Sandboxes

There is no socket to connect to: connect() and every task raise DaemonUnavailableError, and fastsandbox info reports it. Nothing in the package takes the place of the daemon. Only the tests of your own code can do without it, against the fake daemon of fastsandbox.testing.

Install the package

uv add fastsandbox
pip install fastsandbox

The wheels are built for CPython 3.12 and later (abi3), on Linux (x86_64 and aarch64) and macOS (x86_64 and arm64); they hold the native extension, so nothing is compiled on installation.

From a checkout

To work on fastsandbox itself, or to run the examples of the repository, build it from a checkout:

git clone https://github.com/aartintelligent/fastsandbox
cd fastsandbox
uv sync                 # builds the native extension, installs the package
uv run fastsandbox info # the daemon, its version, the socket

uv sync builds the extension in debug mode, which is fast to compile; a change to a Rust file rebuilds it on the next uv run. just wheel builds the release wheel of the platform into dist/.

Check the installation

fastsandbox info connects to the daemon and prints what it found:

socket       /home/me/.local/state/sandboxes/sandboxes/sandboxd/sandboxd.sock
sbx          v0.54.1 (healthy)
api          0.52.0 (supported >=0.52.0, <0.53.0)
sandboxes    0
kit cache    memory, kits forged without the sbx CLI
  • socket: the socket of the daemon, taken from the DOCKER_SANDBOXES_API environment variable, otherwise from the state directory of sbx (default_socket_path()).
  • sbx and api: the version of the daemon and of its API, and the range of API versions this release of fastsandbox has been audited on (SUPPORTED_API), its minimum included and its maximum excluded. connect(), and so every task, refuses a daemon outside that range with UnsupportedVersionError unless told otherwise. fastsandbox info reports it all the same: it warns sandboxd speaks API …, which this release of fastsandbox was not audited on on standard error, then prints its report and exits 0, so check that api is in the range. See The API version.
  • kit cache: where kit packages are kept: the memory of the process by default, or the directory $FASTSANDBOX_KIT_CACHE names.

The first sandbox of a kit

The first sandbox of a kit forges it: the daemon pulls the published image of the base kit, once, then the forge rebuilds the kit from it in a few seconds. The package is kept for the next sandboxes of the same composition, for as long as it suits the daemon. A kit that only the sbx CLI builds or resolves (a directory, a ZIP file or a Git repository as the base kit; an image, a ZIP file or a Git repository as a mixin) is compiled by the CLI when asked, which can take a few minutes for an agent kit; fastsandbox kits compile does it ahead of a run, into the kit cache on disk:

fastsandbox kits compile ./kits/my-local-kit

The package it compiles serves an application whose cache compiles with the CLI, FastSandbox(kits=KitCache(sbx="sbx")), which takes it from that cache (see Command line). The default cache forges, and raises KitForgeError for a base kit only the CLI builds, whether it was compiled ahead or not.

Next