Следующий bash-сценарий иллюстрирует применение команды
pct
для создания контейнера:
#!/bin/bash
hostname="pve02"
vmid="104"
template_path="/var/lib/vz/template/cache"
storage="local"
description="alt-p10"
template="alt-p10-rootfs-systemd-x86_64.tar.xz"
ip="192.168.0.93/24"
nameserver="8.8.8.8"
ram="1024"
rootpw="password"
rootfs="4"
gateway="192.168.0.1"
bridge="vmbr0"
if="eth0"
#### Execute pct create using variable substitution ####
pct create $vmid \
$template_path/$template \
-description $description \
-rootfs $rootfs \
-hostname $hostname \
-memory $ram \
-nameserver $nameserver \
-storage $storage \
-password $rootpw \
-net0 name=$if,ip=$ip,gw=$gateway,bridge=$bridge