LinuxCommandLibrary

pct

Manage Proxmox containers and VMs

TLDR

List all containers

$ pct list
copy

Start/Stop/Reboot a specific container
$ pct [start|stop|reboot] [100]
copy

Access a specific container's shell
$ pct [[en|enter]] [100]
copy

Create a container from template with 4GB size
$ pct [[cr|create]] [100] [local:vztmpl/distro-name.tar.zst] --rootfs [local-lvm]:4
copy

Resize the container's disk to 20G
$ pct [[resi|resize]] [100] [rootfs|mpX] [20G]
copy

Show the configuration of a container, specifying its ID
$ pct [[conf|config]] [100]
copy

Snapshot a specific container with description
$ pct [[sn|snapshot]] [100] [my-snapshot] --description [My snapshot description]
copy

Destroy a container and remove all related resources
$ pct [[des|destroy]] [100] --purge
copy

SYNOPSIS

pct [global-options] command [args] [options]

PARAMETERS

-cluster
    Select cluster to operate on.
(Default: current cluster)

-force
    Force execution, override safety checks.

-h, -?, --help
    Display help and exit.

--version
    Display version information.

-n
    Target specific Proxmox node.

-f, --config
    Use custom config file instead of default.

--debug
    Enable debug output.

-quiet
    Reduce output verbosity.

DESCRIPTION

The pct command is the primary CLI tool for managing Linux Containers (LXC) in Proxmox Virtual Environment (VE). It enables administrators to create, configure, start, stop, migrate, snapshot, backup, and monitor unprivileged LXC containers on Proxmox nodes.

pct operates within a Proxmox cluster or standalone node, leveraging LXC for lightweight virtualization. Containers managed by pct share the host kernel, providing near-native performance ideal for hosting applications, services, or even full OS environments with minimal overhead compared to full VMs.

Key workflows include initializing containers from templates (pct create), attaching storage devices, setting network interfaces via config files, and live-migrating between cluster nodes. pct integrates seamlessly with Proxmox features like HA clustering, firewalls, and ZFS storage.

Configuration is stored in /etc/pve/lxc/<vmid>.conf, editable directly or via pct set. Monitoring commands like pct status or pct monitor provide real-time insights. pct requires Proxmox VE installation and appropriate privileges (typically root or PVE admin). It's essential for DevOps, cloud providers, and homelabs using Proxmox for container orchestration.

CAVEATS

Requires Proxmox VE environment; not available on standard Linux distros. Needs root/PVE admin privileges. Subcommands have additional options (e.g., pct create --help). Containers must use valid VMIDs (100-999999).

COMMON SUBCOMMANDS

create vmid: Initialize from template.
start vmid: Boot container.
stop vmid: Shutdown.
status vmid: Check running state.
config vmid: Show/edit config.
migrate vmid target: Live migrate.

CONFIG FILE

Default: /etc/pve/lxc/<vmid>.conf. Key sections: arch, cores, memory, net0, rootfs.

HISTORY

Developed by Proxmox Server Solutions GmbH as part of Proxmox VE since version 1.5 (2010). Evolved with LXC upstream integration from 2.0 onward, supporting unprivileged containers since VE 4.0 (2016). Actively maintained, with major updates aligning to LXC releases.

SEE ALSO

qm(1), pvesh(1), pvecm(1), lxc(8)

Copied to clipboard