Base images
Use a Debian base image for the target architecture:sail.Image.debian_arm64 and debian_amd64 (aliases
debian_arm / debian_amd) pin the image to your local Python version for
@sail.function.
Install Python packages
Install Python dependencies at build time:exec().
Add local files
Copy a single local file into the image:$,
", or \. File names inside an uploaded directory cannot contain $, ",
or \ either. Directory uploads preserve file
modes from the local filesystem and skip symlinks. ignore accepts
gitignore-style patterns, or point at an existing ignore file (such as
.gitignore) instead.
Use image files for source code, static assets, and configuration that should
exist before boot. Use Filesystem for runtime inputs,
outputs, logs, and data that changes per Sailbox.
Install system packages
Install Debian packages with apt:Run shell commands
Run shell commands during the image build:Set environment variables
Bake environment variables into Sailboxes created from the image:_ and contain only letters,
numbers, and _. Anything else is rejected when the image is built.
Create a Sailbox from an image
Pass the image definition toSailbox.create():
Sailbox.create() uploads any local files, builds
the image if it has not already been built, then starts the VM from that image.
In Rust, build_image_definition runs that same upload-and-build pipeline and
returns the built spec to create from.
Build an image ahead of time
Build the image before creating a Sailbox:Hidden boots and start snapshots
Sail may boot your image outside of any Sailbox you create, first as the final stage of the build pipeline and again periodically while the image is in active use, to capture and refresh a start snapshot. Sailboxes created from the image resume from that snapshot instead of cold-booting, which makes starts fast at any size. Refreshing matters because platform updates invalidate existing snapshots; re-capturing keeps an image’s creates fast for as long as it is being used. A new custom image becomes ready only after Sail captures start snapshots for the S, M, and L sizes. This increases the total image build time. It removes the cold boot from the first Sailbox that uses the image. Built-in images use snapshots that Sail prepares when Sailbox capacity starts. This is part of the image contract:- Your image may boot at times you don’t control. Boot-time initialization (systemd units, init scripts, services configured to start on boot) runs during every hidden boot, at build time and during periodic refreshes while the image is in use. Write boot-time jobs to be safe to run repeatedly, at any time, outside any Sailbox.
- State generated during a hidden boot may be shared. Anything your boot process writes to disk or leaves in memory becomes part of the start snapshot that every Sailbox created from this image resumes from. Do not generate per-instance identity (machine IDs, cryptographic nonces, cached credentials) during boot and expect it to be unique per Sailbox.
- Per-Sailbox identity is injected at create time. Environment variables, networking, and Sail-managed credentials are applied when each Sailbox is created, after the snapshot resumes, so runtime configuration behaves the same whether or not a start snapshot was used.
- Snapshot refreshes after platform updates are best-effort. If a refreshed snapshot is not available, the next Sailbox can use a cold boot.