This shows you the differences between two versions of the page.
saisp:labs:07:contents:02 [2014/04/13 21:23] alexandru.carp [01. Interactiunea cu containerele] |
saisp:labs:07:contents:02 [2014/04/14 11:41] (current) alexandru.carp |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ==== 01. Interactiunea cu containerele ==== | + | ==== 02. [20p] Interactiunea cu containerele ==== |
Masina virtuala **saisp-vm-1** contine un container deja creat, cu numele ''ct1''. | Masina virtuala **saisp-vm-1** contine un container deja creat, cu numele ''ct1''. | ||
Line 47: | Line 47: | ||
</code> | </code> | ||
+ | O varianta mai comoda este pornirea containerului in **background**. Vom adauga parametrul ''-d'' la comanda ''lxc-start'': | ||
+ | <code bash> | ||
+ | root@saisp-vm-1:~# lxc-start -n ct1 -d | ||
+ | </code> | ||
+ | Verificam starea containerului folosind ''lxc-info'': | ||
+ | <code bash> | ||
+ | root@saisp-vm-1:~# lxc-info -n ct1 | ||
+ | state: RUNNING | ||
+ | pid: 8269 | ||
+ | </code> | ||
+ | |||
+ | Pentru a putea interactiona cu un container pornit in background, trebuie sa ne conectam la consola acestuia. Folosim comanda ''lxc-console'': | ||
+ | <code bash> | ||
+ | root@saisp-vm-1:~# lxc-console -n ct1 | ||
+ | |||
+ | Type <Ctrl+a q> to exit the console, <Ctrl+a Ctrl+a> to enter Ctrl+a itself | ||
+ | |||
+ | Debian GNU/Linux 6.0 ct1 tty1 | ||
+ | |||
+ | ct1 login: | ||
+ | </code> | ||
+ | Apoi, ne putem deconecta, fara a opri containerul, folosind combinatie de taste **CTRL+A, Q**. |