Basic operations in OpenVZ environment/ru

From OpenVZ Virtuozzo Containers Wiki
< Basic operations in OpenVZ environment
Revision as of 01:17, 30 December 2015 by Sergey Mamonov (talk | contribs) (Created page with "Где <tt>CTID</tt> это числовой ID контейнера; <tt>osname</tt> это имя шаблона ОС(OS template) container|контейне...")
Jump to: navigation, search

Данная статья предполагает, что у Вас уже установлен Openvz. Если не установлен, то пройдите по ссылке, что бы выполнить необходимые для установки действия.

Создание и запуск контейнера

Для создания и запуска контейнера, выполните следующие команды:

[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

Где CTID это числовой ID контейнера; osname это имя шаблона ОС(OS template) контейнера, и a.b.c.d это IP адрес, который будет назначен контейнеру.

Example:

[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

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

[host-node]# vzctl exec CTID ps ax

Enter to and exit from the container

To enter container give the following command:

[host-node]# vzctl enter CTID
entered into container CTID
[container]#

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

[container]# exit
exited from container VEID
[host-node]#

Stop and destroy the container

To stop container:

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

And to destroy container:

[host-node]# vzctl destroy CTID
Destroying container private area: /vz/private/CTID
Container private area was destroyed

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