Skip to main content

Run your first sandbox

Having trouble with a local installation? Choose your platform for setup checks and fixes.
1

Install microsandbox

For application code, install the SDK for your language. For terminal workflows, use one of the CLI options above. Both run microsandbox locally by default; there is no separate server or daemon to set up. The same installation also drives microsandbox cloud when an API key is set.
Check local virtualization support with:
For platform-specific setup notes, see Linux troubleshooting, macOS troubleshooting, or Windows troubleshooting.
2

Run code in a sandbox

Create a sandbox, execute code inside it, and get the result back.

What just happened?

Here’s what happened behind that Sandbox.builder(...).create() call:
  1. Pulled the image from Docker Hub, unless it was already cached.
  2. Assembled a copy-on-write filesystem so changes inside the sandbox do not modify the base image.
  3. Booted a microVM as a child process with the resource limits you configured.
  4. Started the guest agent so the SDK can run commands and move data in and out.
The exec call uses the host-guest command channel, not SSH and not the sandbox network.
Want the same sandbox on hosted infrastructure? Set MSB_BACKEND=cloud and export MSB_API_KEY; the code above then runs on microsandbox cloud unchanged.

Next steps