LinuxCommandLibrary

pct-destroy

Destroy Proxmox LXC container

TLDR

Destroy a container

$ pct [[des|destroy]] [100]
copy

Destroy a container even if it's running
$ pct [[des|destroy]] [100] --force
copy

Also delete all references to this container
$ pct [[des|destroy]] [100] --purge
copy

SYNOPSIS

pct destroy <vmid> [OPTIONS]

PARAMETERS

<vmid>
    The unique numeric ID (VMID) of the Linux Container (LXC) that you wish to permanently destroy. This is a mandatory argument.

--force <boolean>
    (Default: 0) If set to 1, the destroy operation will proceed even if the container is currently running. Using this option on a running container can lead to data corruption or unexpected behavior. Use with extreme caution.

--destroy-unreferenced-disks <boolean>
    (Default: 0) If set to 1, this option will also destroy any disk volumes that are associated with the container but are no longer referenced in its configuration. This helps in cleaning up orphaned disk images.

DESCRIPTION

The pct-destroy command is a critical command-line utility within Proxmox Virtual Environment (PVE) used to permanently remove a Linux Container (LXC) from a Proxmox node.

When a container is destroyed, its configuration, all associated disk images, and any data residing within those disks are deleted from the system. This operation is irreversible and should always be used with extreme caution, as data loss is permanent.

It serves as an essential tool for system administrators to manage disk space, free up system resources, and clean up obsolete or unused containers on their Proxmox servers. The command requires the unique virtual ID (VMID) of the container as its primary argument.

CAVEATS

Irreversible Operation: Destroying a container is permanent. All data, configuration, and disk images associated with the VMID will be irrecoverably lost.

Data Loss: Ensure all critical data is backed up before attempting to destroy a container.

Use with Caution: Always double-check the VMID to ensure you are destroying the correct container. Accidental deletion of a production container can lead to significant downtime and data loss.

Running Containers: Using the --force option on a running container can lead to inconsistencies or data corruption. It is highly recommended to stop a container gracefully before destroying it.

IMPORTANT CONSIDERATIONS BEFORE DESTRUCTION

Before executing the pct destroy command, it is strongly recommended to confirm that all necessary data within the container has been backed up. Proxmox offers integrated backup solutions (e.g., vzdump), but direct container destruction bypasses these mechanisms for data preservation. Always verify the VMID of the target container to prevent accidental deletion of an unintended or critical resource.

HISTORY

The pct command-line utility set is an integral component of Proxmox Virtual Environment (PVE), which was initially released in 2007. As Proxmox VE evolved to support Linux Containers (LXC) alongside QEMU/KVM virtual machines, the pct commands, including pct-destroy, were developed to provide robust command-line management capabilities for LXC containers.

The ability to reliably create, manage, and destroy containers from the command line has been a core feature from the early stages of LXC integration within Proxmox, reflecting the project's focus on powerful and flexible system administration tools.

SEE ALSO

pct(1), pct create(1), pct start(1), pct stop(1), qm destroy(1)

Copied to clipboard