Следующий bash-сценарий иллюстрирует применение команды
pct для создания контейнера:
#!/bin/bash
hostname="altLXC"
vmid="108"
template_path="/var/lib/vz/template/cache"
storage="local"
description="alt-p11"
template="alt-p11-rootfs-systemd-x86_64.tar.xz"
ip="192.168.0.94/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,bridge=$bridge,gw=$gateway,ip=$ip