View Categories

Vzctl – a quick guide to every day use commands

1 min read

This guide will show you examples of useful common vzctl commands. (Note: the command prlctl is essentially inerchangeable with vzctl and was introduced by the commercial Virtuozzo OpenVZ distribution)

For this example commands, we will use 100 as CTID.

Get a list of your running VMs:

$ vzlist

Get a list of all of your VMs (running and stopped):

$ vzlist -a

Start a container by using vzctl command:

$ vzctl start 100

Stop a container by using vzctl command:

$ vzctl stop 100

Force stop a container without waiting for processes to end:

$ vzctl stop 100 --fast

Restart a container by using vzctl command:

$ vzctl restart 100

Log inside container direct from the node:

$ vzctl enter 100

Destroy a container:

$ vzctl destroy 100

You can also suspend the container:

$ vzctl suspend 100

Set a new hostname for the container:

$ vzctl set 100 –hostname my-new-hostname –save

Adding new IP to the container:

$ vzctl set 100 –ipadd xx.xx.xx.xx –save

Removing IP to the container:

$ vzctl set 100 –ipdel xx.xx.xx.xx –save

Add a new nameserver:

$vzctl set 100 –nameserver xx.xx.xx.xx –save

Reset container’s root password:

$ vzctl set 100 –userpasswd root:new_password –save

Executing commands inside container from the node:

$ vzctl exec 100 ls /home

Check container resources:

$ vzctl -v 100