pct-set
Modify container configuration
TLDR
Set container to start automatically on boot
Set a container to have a static IP
Set container memory and CPU limit
Mount a host file location in a guest
Set container tags
Remove an option
SYNOPSIS
pct set <vmid> [<OPTIONS>]
PARAMETERS
<vmid>
The unique ID (integer) of the container to modify. This is a mandatory argument.
--hostname <string>
Sets the hostname inside the container.
--memory <integer>
Sets the container's RAM limit in MB. A value of 0 means no limit.
--swap <integer>
Sets the container's swap space limit in MB.
--cores <integer>
Sets the number of CPU cores allocated to the container.
--cpulimit <integer>
Sets the CPU usage limit in percent (e.g., 50 for 50%). Values greater than 100 are possible for multi-core CPUs.
--cpuunits <integer>
Sets CPU weight for scheduler (defaults to 1024). Higher values give more CPU time.
--net<id> <string>
Configures a network device. <id> is the device index (e.g., net0, net1). The <string> specifies properties like name, bridge, ip, gw, macaddr, rate, etc.
--rootfs <volume>
Defines the root filesystem of the container, e.g., local-lvm:10 or local-zfs:subvol-100-disk-0. Can also modify size with size=<size>.
--unprivileged <0|1>
Sets the container to unprivileged (1) or privileged (0) mode. Unprivileged containers offer better security isolation.
--onboot <0|1>
Defines if the container should start automatically when the Proxmox host boots (1 for yes, 0 for no).
--autostart <0|1>
Similar to --onboot, but specifically for containers managed by the HA manager in a cluster. Enables/disables automatic start.
--features <string>
Enables specific kernel features inside the container, e.g., nesting=1 (for nested virtualization), keyctl=1, fuse=1, etc. Multiple features can be comma-separated.
--hookscript <path>
Path to a script that will be executed during various container lifecycle events (start, stop, etc.).
--nameserver <string>
Sets the DNS nameserver for the container.
--searchdomain <string>
Sets the DNS search domain for the container.
DESCRIPTION
The pct set command is a subcommand of the pct utility, used within Proxmox Virtual Environment (PVE) to modify various configuration parameters and resource limits for a specific Linux Container (LXC). It allows administrators to fine-tune aspects like CPU, memory, network interfaces, storage, boot behavior, and security features for existing containers. Changes made with pct set are typically persistent and stored in the container's configuration file, located in /etc/pve/lxc/<vmid>.conf. Many configuration changes, especially those related to resource limits or hardware definitions, require the container to be restarted to take full effect. This command is essential for managing the lifecycle and performance of LXC containers on a Proxmox host.
CAVEATS
The pct set command directly modifies the container's configuration file. Incorrect parameters or values can lead to a non-functional container. Always ensure correct syntax and valid values.
Most resource-related changes (CPU, memory, networking) require the container to be restarted for the new settings to take effect.
The command must be run with root privileges on the Proxmox host.
CONFIGURATION FILE LOCATION
Every LXC container's configuration is stored in a file named <vmid>.conf within /etc/pve/lxc/. For example, container 101's configuration would be at /etc/pve/lxc/101.conf. The pct set command directly modifies this file.
APPLYING CHANGES
While pct set immediately updates the configuration file, many parameters (especially those affecting resource allocation or hardware) only take effect after the container is stopped and then started again. For example, changing --memory or --cores requires a restart.
HISTORY
The pct command-line utility is an integral part of Proxmox Virtual Environment (PVE), a Debian-based virtualization management solution. Proxmox initially supported OpenVZ for containers but transitioned to LXC (Linux Containers) with PVE 3.0, released in 2013. The pct command suite was developed to provide a unified and robust interface for managing LXC containers, mirroring the functionality previously offered for OpenVZ, and integrating seamlessly with PVE's web interface and clustering capabilities. The pct set subcommand emerged as the primary tool for modifying the configuration of these LXC containers.