Home > OpenVZ > Openvz -Create and start a container

Openvz -Create and start a container

December 22nd, 2008 Leave a comment Go to comments

To create and start a container, run the following commands:

vzctl create CTID –ostemplate osname
vzctl set CTID –ipadd <ipaddress>  –save
vzctl set CTID –nameserver <ipaddress> –save
Vzctl start CTID

Here CTID is the numeric ID for the container; osname is the name of the OS template for the container.

Example:

vzctl create 101 –ostemplate fedora-core-5-minimal
vzctl set 101 –ipadd 192.11.0.3 –save
vzctl set 101 –nameserver 192.11.0.3 –save
vzctl start 101

Your freshly-created container should be up and running now; you can see its processes:

vzctl exec CTID ps ax

Enter to and exit from the container

To enter container give the following command:

vzctl enter CTID
entered into container CTID
[container]#

To exit from container, just type exit and press Enter:

[container]# exit
exited from container VEID

Stop and destroy the container

To stop container:

vzctl stop CTID
Stopping container …
Container was stopped
Container is unmounted

And to destroy container:

vzctl destroy CTID
Destroying container private area: /vz/private/CTID
Container private area was destroyed

Source - openvz forums

Categories: OpenVZ Tags:
  1. No comments yet.
  1. No trackbacks yet.