- On-the-fly Installation: Install packages before each execution. Flexible but slower.
- Custom Images: Bake packages into the Docker image. Fast and reproducible.
Strategy 1: On-the-Fly Installation
Great for prototyping or when you need different packages for every run.- CLI
- Library
- API
Use
--install <package> (can be repeated).Runtime installs are written under
/sandbox (for example /sandbox/.local, /sandbox/.npm-global, /sandbox/.bun-global). This is intentional because /tmp is mounted noexec.Strategy 2: Custom Images (Recommended)
Bake your dependencies into a custom Docker image (isol8:python-custom-<hash>, etc.). This eliminates installation time during execution.
Creating Custom Images
Runisol8 setup with package flags.
isol8:python-custom-a1b2c3d4e5f6) that extends the base isol8:python image.
Using Custom Images
Once built, isol8 automatically prefers the custom image. You don’t need any special flags.Config File (isol8.config.json)
Define dependencies in your config file to ensure consistent environments across your team.
isol8 setup to apply changes.
Image Architecture
Understanding how images are built helps optimize your setup.Base Images
isol8:python: Python 3.x + pipisol8:node: Node.js LTS + npmisol8:bun: Bun runtimeisol8:deno: Deno runtimeisol8:bash: Bash + apk
Custom Images
Custom images extend the base image. For example, a hashed Python custom image is built like this:Smart Rebuilds
isol8 setup is intelligent. It avoids unnecessary work by tracking build state using Docker labels.
- Change Detection: It computes SHA256 hashes of your
docker/directory (for base images) and your dependency lists (for custom images). - Metadata: These hashes are stored in the image labels
org.isol8.build.hashandorg.isol8.deps.hash. - Fast Path: If the hashes match the existing image, the build is skipped instantly.
- Auto-Cleanup: When a rebuild is necessary, isol8 automatically removes the old image version to prevent “dangling images” from clogging your disk.
--force to bypass this check and rebuild unconditionally.
FAQ
Should I use `--install` or custom images?
Should I use `--install` or custom images?
Use
--install for ad-hoc experimentation. Use custom images for repeatable production workloads and lower execution latency.Why do some native packages fail when installed in temp directories?
Why do some native packages fail when installed in temp directories?
Native modules often need executable mount points. isol8 installs runtime packages under
/sandbox because /tmp is mounted with noexec.Do setup flags and config dependencies combine?
Do setup flags and config dependencies combine?
Yes.
isol8 setup merges dependency flags (--python, --node, etc.) with configured dependencies before building custom images.Troubleshooting quick checks
- Install step is too slow: pre-bake dependencies with
isol8 setupanddependenciesconfig. - Package import still fails after install: verify runtime/package pairing (for example Python package in Python runtime).
- Custom image not updating: rerun
isol8 setup --force. - Disk usage growing from images: run
isol8 cleanup --imagesto remove isol8 images.