Template Commands
Manage templates from the command line
Template Commands
The ve template commands let you create, build, list, and delete custom sandbox templates. Templates define the base environment for your sandboxes, including installed system packages, language runtimes, and pre-configured files.
Initialize a New Template
Scaffold a new template with a ve.toml configuration file and a Dockerfile:
ve template init <directory>$ ve template init my-analytics
✓ Created my-analytics/ve.toml
✓ Created my-analytics/Dockerfile
Template initialized in my-analytics/Generated ve.toml
The ve.toml file defines metadata and configuration for your template:
# ve.toml - Vibengine template configuration
# Unique identifier for this template
template_id = "my-analytics"
# Human-readable name shown in the dashboard
template_name = "My Analytics Environment"
# Dockerfile to use for building the template
dockerfile = "Dockerfile"
# Start command executed when the sandbox boots
start_cmd = "/bin/bash"
# CPU and memory allocated to each sandbox (optional)
# cpu_count = 2
# memory_mb = 512Generated Dockerfile
The starter Dockerfile extends the Vibengine base image:
FROM vibengine/base:latest
# Install system packages
RUN apt-get update && apt-get install -y \
curl \
&& rm -rf /var/lib/apt/lists/*
# Install Python packages
RUN pip install pandas numpy matplotlib
# Copy project files (optional)
# COPY ./data /home/user/data
# Set the working directory
WORKDIR /home/userAlways extend from vibengine/base:latest to ensure compatibility with the Vibengine runtime. This base image includes the kernel, networking, and file system layers that sandboxes require.
Build a Template
Build the Docker image and push it to the Vibengine registry:
ve template build <directory>$ ve template build my-analytics/
Building template "my-analytics"...
Step 1/5 : FROM vibengine/base:latest
---> a1b2c3d4e5f6
Step 2/5 : RUN apt-get update && apt-get install -y curl
---> Running in 7a8b9c0d1e2f
---> 3f4a5b6c7d8e
Step 3/5 : RUN pip install pandas numpy matplotlib
---> Running in 9e0f1a2b3c4d
---> 5d6e7f8a9b0c
Step 4/5 : WORKDIR /home/user
---> 1c2d3e4f5a6b
Step 5/5 : Done
Pushing to registry...
✓ Template "my-analytics" built and pushed successfully.
Template ID: my-analytics
Size: 342 MB
Build time: 47sBuild with a Custom Dockerfile Path
If your Dockerfile is not in the template directory or has a different name:
ve template build my-analytics/ --dockerfile ./custom.DockerfileList Templates
Show all templates in your account:
ve template list$ ve template list
ID NAME SIZE CREATED
base Base Template 128 MB (built-in)
my-analytics My Analytics Environment 342 MB 2 hours ago
ml-pipeline ML Pipeline 1.2 GB 3 days ago
web-scraper Web Scraper 256 MB 1 week ago
4 templatesDelete a Template
Remove a template from the registry:
ve template delete <template-id>$ ve template delete web-scraper
Delete template "web-scraper"? This cannot be undone. (y/N) y
✓ Template "web-scraper" deleted.Deleting a template does not affect running sandboxes that were created from it. However, you will not be able to create new sandboxes from a deleted template.
Example Workflow: Data Science Template
Here is a complete workflow for creating a data science template:
# Step 1: Initialize
ve template init data-science
# Step 2: Edit the Dockerfile
# Add your packages and configuration
# Step 3: Build and push
ve template build data-science/
# Step 4: Verify
ve template list
# Step 5: Use in codeThen use the template in your application:
import { Sandbox } from "vibengine";
const sandbox = await Sandbox.create({
template: "data-science",
apiKey: process.env.VE_API_KEY,
});from vibengine import Sandbox
sandbox = Sandbox.create(
template="data-science",
api_key=os.environ["VE_API_KEY"],
)Command Reference
| Command | Description |
|---|---|
ve template init <dir> | Scaffold a new template with ve.toml and Dockerfile |
ve template build <dir> | Build and push a template to the registry |
ve template build <dir> --dockerfile <path> | Build with a custom Dockerfile |
ve template list | List all templates in your account |
ve template delete <id> | Delete a template from the registry |