Changes

Jump to: navigation, search

Basic operations in OpenVZ environment/en

1,809 bytes added, 13:02, 13 February 2016
Importing a new version from external source
This article assumes you have already [[Quick installation|installed OpenVZ]]. If not, follow the link to perform the steps needed.

== Create and start a container ==

To create and start a [[container]], run the following commands:
<pre>
[host-node]# vzctl create CTID --ostemplate osname
[host-node]# vzctl set CTID --ipadd a.b.c.d --save
[host-node]# vzctl set CTID --nameserver a.b.c.d --save
[host-node]# vzctl start CTID
</pre>

Here <tt>CTID</tt> is the numeric ID for the [[container]]; <tt>osname</tt> is the name of the OS template for the [[container]], and <tt>a.b.c.d</tt> is the IP address to be assigned to the [[container]].

Example:
<pre>
[host-node]# vzctl create 101 --ostemplate fedora-core-5-minimal
[host-node]# vzctl set 101 --ipadd 10.1.2.3 --save
[host-node]# vzctl set 101 --nameserver 10.0.2.1 --save
[host-node]# vzctl start 101
</pre>

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

<pre>
[host-node]# vzctl exec CTID ps ax
</pre>

== Enter to and exit from the container ==

To enter [[container]] give the following command:
<pre>
[host-node]# vzctl enter CTID
entered into container CTID
[container]#
</pre>

To exit from [[container]], just type <code>exit</code> and press Enter:
<pre>
[container]# exit
exited from container VEID
[host-node]#
</pre>

== Stop and destroy the container ==

To stop [[container]]:

<pre>
[host-node]# vzctl stop CTID
Stopping container ...
Container was stopped
Container is unmounted
</pre>

And to destroy [[container]]:
<pre>
[host-node]# vzctl destroy CTID
Destroying container private area: /vz/private/CTID
Container private area was destroyed
</pre>

Now, when you know how to manage your [[container]], learn about [[Resource management]].

[[Category: Installation]]
[[Category: HOWTO]]
1,433
edits

Navigation menu