Template File
A template is a TOML file with default values for a new VM instance. Pass it to
cubic create or cubic run with --template. Create from a Template shows
how to use one.
Every field except version is optional and falls back to the Cubic default
when it is left out, see Names, Sizes and Defaults. A command line argument always wins over
the template.
Field |
Value |
Description |
|---|---|---|
|
|
Format version of the template. Mandatory. |
|
name and tag, |
Distribution image of the VM instance. A plain name means the |
|
user name, |
User account inside the guest. Defaults to your user name on the host. |
|
number, |
vCPUs of the VM instance. Defaults to a value derived from the resources of the host. |
|
size, |
Memory of the VM instance. Defaults to a value derived from the resources of the host. |
|
size, |
Disk capacity of the VM instance. Defaults to 100 GiB. A disk can only grow later. |
|
|
Cuts the VM instance off the network. Defaults to |
|
list of |
Forwarded ports, with an optional protocol such as |
|
list of shell commands |
Commands the guest runs once on its first boot, as root. |
Example
version = 1 # mandatory
image = "debian" # optional
user = "john" # optional
cpus = 4 # optional
memory = "4G" # optional
disk = "100G" # optional
isolate = false # optional
ports = [ # optional
"8000:80", # forward guest HTTP port to host TCP port 8000
"5353:53/udp" # forward guest DNS port to host UDP port 5353
]
run = [ # optional, run once on the first boot as root
"apt update",
"apt full-upgrade -y",
"apt install -y vim"
]