Input Resolution
Code is resolved from three sources, checked in priority order. The first match wins:--evalflag — Inline code string passed directly on the command line. Defaults topythonruntime if--runtimeis not specified.- File argument — Path to a script file. The runtime is auto-detected from the file extension via
RuntimeRegistry.detect(). Use--runtimeto override. - Stdin — Piped input read from
process.stdin. Defaults topythonruntime if--runtimeis not specified.
Extension-to-Runtime Mapping
When a file argument is provided without--runtime, the runtime is auto-detected from the file extension:
| Extension | Runtime |
|---|---|
.py | python |
.js, .mjs, .cjs | node |
.ts | bun |
.mts | deno |
.sh | bash |
--runtime.
Options
Code Input
Execute inline code string. Defaults to
python runtime if --runtime is not specified.Force runtime:
python, node, bun, deno, or bash. Overrides auto-detection from file extension.Data to pipe to the process via stdin. This is input to the running program, not the source code itself. The data is written to a file inside the container and piped into the command via
cat.Install a package before execution using the runtime’s package manager. Repeatable — use
--install pkg1 --install pkg2 for multiple packages.Execution
Use a persistent container that preserves state between runs. Without this flag, each execution uses a fresh container from the warm pool. In persistent mode, the CLI creates a
RemoteIsol8 session (when --host is used) with a unique sessionId, or a local DockerIsol8 in persistent mode.Keep the container running after execution completes, instead of cleaning it up. Useful for debugging — you can inspect the container’s filesystem, processes, and state after a run. Note: this is different from
--persistent, which keeps a container alive between runs for stateful sessions.Enable debug logging for internal engine operations. When set, isol8 prints detailed logs about container lifecycle, pool operations, persist decisions, and other internal state. These logs use the
[DEBUG] prefix and are suppressed by default.Disable real-time output streaming. By default, output is streamed as it is generated. Use this flag to buffer output and display it only after execution completes.
Execution timeout in milliseconds. The process is killed with
SIGKILL via the timeout -s KILL wrapper when the limit is reached. Falls back to config.defaults.timeoutMs.Resource Limits
Memory limit for the container. Accepts Docker memory format:
256m, 512m, 1g, 2g. Falls back to config.defaults.memoryLimit.CPU limit as a fraction of one core.
0.5 = half a core, 2.0 = two cores. Converted to Docker NanoCpus internally. Falls back to config.defaults.cpuLimit.Maximum number of processes (PIDs) allowed inside the container. Prevents fork bombs.
Size of the
/sandbox tmpfs mount. Increase for data-intensive workloads that write large files. Accepts Docker size format: 64m, 128m, 256m.Maximum output size in bytes before truncation. Default is 1MB (1,048,576 bytes). When exceeded, output is truncated and
result.truncated is set to true.Security
Network mode for the container:
none— No network access (default, most secure). Container is created withNetworkDisabled: true.host— Full host network access. Container usesNetworkMode: "host".filtered— Bridge network with an HTTP/HTTPS filtering proxy. Container getsNetworkMode: "bridge"withHTTP_PROXY/HTTPS_PROXYenv vars pointing to the internalproxy.mjsprocess.
Whitelist regex pattern for
filtered network mode. Only hostnames matching the pattern are allowed through the proxy. Repeatable — use --allow pattern1 --allow pattern2 for multiple patterns. Falls back to config.network.whitelist.Blacklist regex pattern for
filtered network mode. Hostnames matching the pattern are blocked by the proxy. Repeatable — use --deny pattern1 --deny pattern2 for multiple patterns. Falls back to config.network.blacklist.Override the Docker image used for execution. Bypasses the runtime adapter’s default image and the
resolveImage() custom image check entirely.Disable read-only root filesystem. By default, containers run with
ReadonlyRootfs: true and writable tmpfs mounts at /sandbox and /tmp. Enable this flag if your code needs to write outside those directories.Secret environment variable in
KEY=VALUE format. The value is injected into the container as an env var and automatically masked with *** in all stdout and stderr output. Repeatable — use --secret KEY1=val1 --secret KEY2=val2 for multiple secrets.Output
Write stdout to a local file instead of printing to the terminal. The output is still displayed on the terminal — this writes an additional copy to the specified file path.
Remote Execution
Execute on a remote isol8 server instead of local Docker. Provide the server URL (e.g.
http://localhost:3000). The CLI creates a RemoteIsol8 client that sends the execution request over HTTP.API key for remote server authentication. Required when using
--host. Falls back to the $ISOL8_API_KEY environment variable. The CLI exits with an error if neither is set.Package Installation
The--install flag uses the runtime’s native package manager to install packages before code execution:
| Runtime | Install Command | Example |
|---|---|---|
python | pip install --no-cache-dir --break-system-packages | --install numpy |
node | npm install -g | --install lodash |
bun | bun install -g | --install zod |
deno | deno cache | --install https://deno.land/std/path/mod.ts |
bash | apk add --no-cache | --install jq |
isol8 setup --python numpy,pandas to bake them into a custom image instead.
Examples
Basic Execution
Real-Time Streaming
Package Installation
Resource Configuration
Secrets
Network Filtering
Persistent Sessions
Remote Execution
The
--net flag defaults to "none" at the Commander level, which means the config file’s defaults.network value is effectively ignored when using the CLI. To use a different network mode, pass --net explicitly (e.g. --net filtered or --net host).FAQ
What is the difference between --persist and --persistent?
--persistentkeeps a container alive between runs so that state (files, environment) is preserved across multiple executions. This is for stateful workflows where you want to build up state incrementally.--persistkeeps the container running after execution completes, instead of cleaning it up. This is a debugging tool — it lets you inspect the container’s filesystem, logs, and processes post-execution.
--persistent --persist gives you a stateful session whose container is not cleaned up when stop() is called.
What does --debug do?
--debug enables verbose internal logging from the isol8 engine. It prints messages about container pool operations, container lifecycle events, and cleanup decisions with a [DEBUG] prefix. It does not affect the executed code’s output — only isol8’s own internal logs.
What happens with different flag combinations?
--persist | --debug | Behavior |
|---|---|---|
false | false | Default. Containers are cleaned up silently after execution. |
false | true | Containers are cleaned up after execution, but internal engine logs are printed. |
true | false | Containers are left running after execution for inspection. No debug logs. |
true | true | Containers are left running after execution, and internal engine logs are printed. |
How is --persist different from cleanup.autoPrune in the config?
--persist(engine-level): Controls per-execution container cleanup. Whentrue, the container used for that execution is not destroyed.cleanup.autoPrune(config-level): Controls whether the server (isol8 serve) automatically prunes idle sessions. This is a server-side periodic cleanup and has no effect on local CLI usage.