The /etc/pve/lxc/<CTID>.conf
file stores container configuration, where
<CTID>
is the numeric ID of the given container. Like all other files stored
inside /etc/pve/
, they get automatically replicated to all other cluster
nodes.
CTIDs < 100 are reserved for internal purposes, and CTIDs need to be unique cluster wide.
Example Container Configuration.
ostype: debian arch: amd64 hostname: www memory: 512 swap: 512 net0: bridge=vmbr0,hwaddr=66:64:66:64:64:36,ip=dhcp,name=eth0,type=veth rootfs: local:107/vm-107-disk-1.raw,size=7G
The configuration files are simple text files. You can edit them using a normal
text editor, for example, vi
or nano
.
This is sometimes useful to do small corrections, but keep in mind that you
need to restart the container to apply such changes.
For that reason, it is usually better to use the pct
command to generate and
modify those files, or do the whole thing using the GUI.
Our toolkit is smart enough to instantaneously apply most changes to running
containers. This feature is called “hot plug”, and there is no need to restart
the container in that case.
In cases where a change cannot be hot-plugged, it will be registered as a pending change (shown in red color in the GUI). They will only be applied after rebooting the container.
The container configuration file uses a simple colon separated key/value format. Each line has the following format:
# this is a comment OPTION: value
Blank lines in those files are ignored, and lines starting with a #
character
are treated as comments and are also ignored.
It is possible to add low-level, LXC style configuration directly, for example:
lxc.init_cmd: /sbin/my_own_init
or
lxc.init_cmd = /sbin/my_own_init
The settings are passed directly to the LXC low-level tools.
When you create a snapshot, pct
stores the configuration at snapshot time
into a separate snapshot section within the same configuration file. For
example, after creating a snapshot called “testsnapshot”, your configuration
file will look like this:
Container configuration with snapshot.
memory: 512 swap: 512 parent: testsnaphot ... [testsnaphot] memory: 512 swap: 512 snaptime: 1457170803 ...
There are a few snapshot related properties like parent
and snaptime
. The
parent
property is used to store the parent/child relationship between
snapshots. snaptime
is the snapshot creation time stamp (Unix epoch).
arch
: <amd64 | arm64 | armhf | i386>
(default = amd64
)
cmode
: <console | shell | tty>
(default = tty
)
console
: <boolean>
(default = 1
)
cores
: <integer> (1 - 8192)
cpulimit
: <number> (0 - 8192)
(default = 0
)
Limit of CPU usage.
If the computer has 2 CPUs, it has a total of 2 CPU time. Value 0 indicates no CPU limit.
cpuunits
: <integer> (0 - 500000)
(default = 1024
)
CPU weight for a VM. Argument is used in the kernel fair scheduler. The larger the number is, the more CPU time this VM gets. Number is relative to the weights of all the other running VMs.
You can disable fair-scheduler configuration by setting this to 0.
debug
: <boolean>
(default = 0
)
description
: <string>
features
: [force_rw_sys=<1|0>] [,fuse=<1|0>] [,keyctl=<1|0>] [,mknod=<1|0>] [,mount=<fstype;fstype;...>] [,nesting=<1|0>]
Allow containers access to advanced features.
force_rw_sys
=<boolean>
(default = 0
)
rw
instead of mixed
. This can break networking under newer (>= v245) systemd-network use.
fuse
=<boolean>
(default = 0
)
keyctl
=<boolean>
(default = 0
)
mknod
=<boolean>
(default = 0
)
mount
=<fstype;fstype;...>
nesting
=<boolean>
(default = 0
)
hookscript
: <string>
hostname
: <string>
lock
: <backup | create | destroyed | disk | fstrim | migrate | mounted | rollback | snapshot | snapshot-delete>
memory
: <integer> (16 - N)
(default = 512
)
mp[n]
: [volume=]<volume> ,mp=<Path> [,acl=<1|0>] [,backup=<1|0>] [,mountoptions=<opt[;opt...]>] [,quota=<1|0>] [,replicate=<1|0>] [,ro=<1|0>] [,shared=<1|0>] [,size=<DiskSize>]
Use volume as container mount point. Use the special syntax STORAGE_ID:SIZE_IN_GiB to allocate a new volume.
acl
=<boolean>
backup
=<boolean>
mountoptions
=<opt[;opt...]>
mp
=<Path>
Path to the mount point as seen from inside the container.
Must not contain any symlinks for security reasons.
quota
=<boolean>
replicate
=<boolean>
(default = 1
)
ro
=<boolean>
shared
=<boolean>
(default = 0
)
Mark this non-volume mount point as available on all nodes.
This option does not share the mount point automatically, it assumes it is shared already!
size
=<DiskSize>
volume
=<volume>
nameserver
: <string>
net[n]
: name=<string> [,bridge=<bridge>] [,firewall=<1|0>] [,gw=<GatewayIPv4>] [,gw6=<GatewayIPv6>] [,hwaddr=<XX:XX:XX:XX:XX:XX>] [,ip=<(IPv4/CIDR|dhcp|manual)>] [,ip6=<(IPv6/CIDR|auto|dhcp|manual)>] [,mtu=<integer>] [,rate=<mbps>] [,tag=<integer>] [,trunks=<vlanid[;vlanid...]>] [,type=<veth>]
Specifies network interfaces for the container.
bridge
=<bridge>
firewall
=<boolean>
gw
=<GatewayIPv4>
gw6
=<GatewayIPv6>
hwaddr
=<XX:XX:XX:XX:XX:XX>
ip
=<(IPv4/CIDR|dhcp|manual)>
ip6
=<(IPv6/CIDR|auto|dhcp|manual)>
mtu
=<integer> (64 - N)
name
=<string>
rate
=<mbps>
tag
=<integer> (1 - 4094)
trunks
=<vlanid[;vlanid...]>
type
=<veth>
onboot
: <boolean>
(default = 0
)
ostype
: <alpine | archlinux | centos | debian | devuan | fedora | gentoo | opensuse | ubuntu | unmanaged>
protection
: <boolean>
(default = 0
)
rootfs
: [volume=]<volume> [,acl=<1|0>] [,mountoptions=<opt[;opt...]>] [,quota=<1|0>] [,replicate=<1|0>] [,ro=<1|0>] [,shared=<1|0>] [,size=<DiskSize>]
Use volume as container root.
acl
=<boolean>
mountoptions
=<opt[;opt...]>
quota
=<boolean>
replicate
=<boolean>
(default = 1
)
ro
=<boolean>
shared
=<boolean>
(default = 0
)
Mark this non-volume mount point as available on all nodes.
This option does not share the mount point automatically, it assumes it is shared already!
size
=<DiskSize>
volume
=<volume>
searchdomain
: <string>
startup
: `[[order=]\d+] [,up=\d+] [,down=\d+] `
swap
: <integer> (0 - N)
(default = 512
)
tags
: <string>
template
: <boolean>
(default = 0
)
timezone
: <string>
tty
: <integer> (0 - 6)
(default = 2
)
unprivileged
: <boolean>
(default = 0
)
unused[n]
: [volume=]<volume>
Reference to unused volumes. This is used internally, and should not be modified manually.
volume
=<volume>