Start sandboxes from your own container image. Deploy the image as a template, read its build, start sandboxes from it, and delete it.
A custom template is a container image that you deploy to your workspace under a name. Munito AI builds the image into a template one time. Each sandbox of the template then starts with the files of the image.
- The image comes from a public registry, such as Docker Hub, or from a private registry.
- The image is for linux/amd64.
- A sandbox of a custom template has each feature of a sandbox: sizes, larger disks, commands, files, ports, SSH, persistence and fork.
Deploy an image
The munito templates commands need version 0.3.0 or later of the command line tool.
munito templates deploy acme-agent ghcr.io/acme/agent:1.4The API answers at once with the template, and the build continues. A build takes from seconds to minutes. A larger image takes more time.
- A name has 1 to 63 lower case letters, digits and hyphens. It starts and ends with a letter or a digit.
- The name of a built-in template, such as
base, is not available. - A new name makes a new template. Its
idstarts withtpl_. - A name that exists gets a new version. The last ready version starts new sandboxes until the new version is ready.
- Give the image with a tag or a digest. An image without a tag or a digest gets the tag
latest. - An image name without a registry, such as
python:3.12-slim, is on Docker Hub.
The Sandboxes console also deploys, shows and deletes templates.
Read the build
munito templates get acme-agent --wait--wait reads the template every 5 seconds until its build ends. When the build fails, the command shows the error and the end of the build output, and exits with code 1.
| Field | Meaning |
|---|---|
status | ready when a version starts sandboxes. Before that, building, or failed if the newest build failed |
version, image, digest, size_bytes | The version that new sandboxes start from. null before a version is ready |
build | The newest version. It can build or fail while an older version starts new sandboxes |
build.error | Why the build failed: a code and a message |
build.log | The end of the build output, when the build failed |
munito templates ls and GET /templates list the templates of your workspace, by name.
Start a sandbox
Set the name of the template, or its id, in template:
munito create --template acme-agent --size small
munito run "python3 --version" --template acme-agent- The sandbox starts from the ready version of the template.
- A sandbox of a custom template has 512 MiB of memory or more, so the
tinysize is not available. - The sandbox boots from the files of the template, and does not restore from a snapshot. It starts in about a second.
- A host that does not have the template yet downloads it before the first start.
| Code | Status | When |
|---|---|---|
template_not_found | 404 | The workspace has no template with this name or id |
template_not_ready | 409 | The template has no ready version. Wait for its build |
Private registry
Give a user name and a password, or an access token, in registry_auth:
echo "$REGISTRY_TOKEN" | munito templates deploy acme-agent ghcr.io/acme/agent:1.4 \
--username acme --password-stdin- The build uses the credential one time. Munito AI does not keep it, and no answer contains it.
- Each deploy of a private image needs the credential again.
- The command line tool reads the token from standard input with
--password-stdin, or from the variableMUNITO_REGISTRY_TOKEN. It has no flag for the token, so the token stays out of your shell history. - Use a token that can only read images. For GitHub Container Registry, use a token with the
read:packagesscope.
What runs in the sandbox
- Commands run as
rootin/workspace, with the environment (ENV) of the image. - The
ENTRYPOINTand theCMDof the image do not run. To start the server of the image, run its command as a background command. - The
WORKDIRof the image is not the work folder. To run a command there, setcwd. - A string command runs in
bash -lc. If the image has no bash, the command runs in/bin/sh. - If the image has no shell, the command runs in a BusyBox shell. Munito AI adds it in
/opt/munito. - SSH, ports, files, persistence and fork operate as in the other templates.
Limits and price
| Limit | Value |
|---|---|
| Platform of the image | linux/amd64 |
| Files of the image | 9 GiB or less. The disk of a template is 10 GiB |
| Time of a build | 20 minutes or less |
| Templates in a workspace | 10 |
| Builds at the same time in an organization | 2 |
- During the preview, the build and the storage of a template are free.
- A sandbox of a custom template pays the price of its size, as each sandbox does.
- To get a larger root disk, set
disk_gibwhen you create the sandbox.
| Code | Status | When |
|---|---|---|
invalid_request | 422 | The name or the image name is not valid |
template_limit | 409 | The workspace has 10 templates. Delete one, or deploy a name that exists |
build_limit | 429 | Your organization has 2 builds now. Deploy again when one ends |
no_capacity | 503 | No host has room for the build. Retry after the Retry-After seconds |
Delete a template
munito templates rm acme-agent- A delete removes the template and each of its versions.
- The sandboxes that run from the template continue to run.
- A delete cannot be reversed. To use the image again, deploy it again.