Skip to main content
A template is the blueprint a sandbox is created from — it defines the base image, installed packages, files, environment, and the commands that run at startup. Every sandbox is spawned from a template, so building a template is how you produce a reusable, ready-to-run environment. Templates are conceptually close to container images: a template is built from a Docker image, and the build process is similar to writing a Dockerfile — you start from a base image and layer instructions on top. The difference is where and how you express those instructions. In short: a template starts from a Docker image. Building one feels similar to authoring a Dockerfile, but you describe the steps with the SDK (fromImage, runCmd, copy, setEnvs, …) instead of a Dockerfile. The output is a templateId that Novita uses to launch sandboxes quickly.

Build

Once a template definition is ready, use novita.template.build(...) to build it.

Names

Every build needs a template name. Keep names stable for a logical template family. The returned template ID is the immutable build output you use at runtime.

Base Image

A template definition always starts by choosing a base image (or an existing template) with one of the from* methods.

User and Workdir

After choosing a base image, you can control which user subsequent build steps run as and which directory they run in.

Tags & versioning

Tags let you label builds for release management without changing the underlying template name.

Logging

Build logs help you inspect provisioning progress and diagnose failures.

Error handling

Template builds can fail for several common reasons:
  • invalid credentials for a private registry
  • package install failures inside runCmd(...) / run_cmd(...)
  • a start command that exits unexpectedly
  • a ready command that never succeeds
  • CPU and memory settings that do not satisfy platform limits
Last modified on August 5, 2026