Skip to main content
SimpleBox runs any OCI container image, so you’re not limited to Python. Use it to run Node.js, Go, Rust, shell scripts, or any CLI tool — just pick the right image and call exec().

What you’ll build

A script that:
  1. Runs Node.js code inside a node:20-slim image
  2. Runs a shell script inside an alpine:latest image
  3. Installs and uses CLI tools
  4. Runs multiple languages in the same box

Prerequisites

Requires Python 3.10+.

Step 1: Run Node.js code

Use the node:20-slim image to run JavaScript inside a sandbox.
run_node.py
What’s happening:
  • SimpleBox pulls the node:20-slim image (cached after first use)
  • exec("node", "-e", "...") runs the JavaScript code inside the VM
  • Output is captured in result.stdout just like any other command

Step 2: Run a shell script

Use alpine:latest for a minimal environment, and run multi-line scripts with sh -c.
run_shell.py

Step 3: Install and run tools

Install packages inside the box using the image’s package manager, then use them.
install_tools.py

Common images and package managers

Step 4: Mix languages in one box

The node:20-bookworm image includes both Node.js and Python 3, so you can combine languages in a single box without installing anything.
multi_language.py
Use slim or minimal images for faster startup. Full images like ubuntu:latest work but are larger and slower to pull on first use. After the first pull, images are cached locally.

Choosing the right image

What’s next?

Run services with port forwarding

Start HTTP servers, databases, or APIs inside a box and access them from the host.

Upload & download files

Copy files into the box, process them, and retrieve results.

Handle errors and debug

Catch exceptions, handle timeouts, and debug failures.

SimpleBox API reference

Full API docs for SimpleBox constructor options and methods.