lxc-destroy
Delete an existing LXC container
TLDR
Delete a container
Display help
SYNOPSIS
lxc-destroy [-f] [-n name]
PARAMETERS
-n name
Specifies the name of the container to destroy.
-f
Forces the container to be stopped and then destroyed. Use with caution as it may lead to data loss.
DESCRIPTION
The lxc-destroy
command permanently removes an existing LXC container and all associated data. This includes the container's root filesystem, configuration files, and any other resources allocated to it.
It's crucial to ensure that the container is stopped before running lxc-destroy
. Otherwise, data loss or corruption might occur. lxc-destroy
offers options for force stopping the container, but this should be used with caution.
This command differs from lxc-stop
which only stops the container but keeps all the container's data for future use. After running lxc-destroy
, the container is unrecoverable, so it's vital to back up any important data before executing this command.
CAVEATS
Destroying a container is an irreversible process. Always verify the container name before running lxc-destroy
. Using the -f
option can cause data corruption if the container is actively writing to disk.
ERROR HANDLING
If the container is not found or there are issues during the destroy process, lxc-destroy
will return an error code. Check the logs (usually under /var/log/lxc/
SEE ALSO
lxc-create(1), lxc-start(1), lxc-stop(1), lxc-info(1)