How to kill an openvz container

openvz

An openvz container can be stopped with

vzctl stop <id>

, but this needs the cooperation from the init inside the container.
In case a container is compromised a way is needed to stop the container withouts its cooperation. Something like a

vzctl kill <id>

is needed which kills all processes inside the container and puts it into the stopped state. Such a kill command is not listed in the manpage.

How can an openvz container be killed/stopped without needing it's cooperation?

Best Answer

http://wiki.openvz.org/User_Guide/Operations_on_Containers#Starting.2C_Stopping.2C_Restarting.2C_and_Querying_Status_of_Container

in case of a Container that is known to be corrupt, you may use the --fast switch:

# vzctl stop 101 --fast
Stopping container ...
Container was stopped
Container is unmounted

Make sure that you do not use the --fast switch with healthy Containers, unless necessary, as the forcible killing of Container processes may be potentially dangerous.

Related Topic