Differences

This shows you the differences between two versions of the page.

Link to this comparison view

saisp:labs:07:contents:02 [2013/11/11 00:46]
127.0.0.1 external edit
saisp:labs:07:contents:02 [2014/04/14 11:41] (current)
alexandru.carp
Line 1: Line 1:
-==== 02. Lorem ipsum ====+==== 02. [20p] Interactiunea cu containerele ​====
  
 +Masina virtuala **saisp-vm-1** contine un container deja creat, cu numele ''​ct1''​.
 +
 +Folosind comanda ''​lxc-start'',​ vom porni containerul:​
 +<code bash>
 +root@saisp-vm-1:​~#​ lxc-start -n ct1
 +
 +INIT: version 2.88 booting
 +Using makefile-style concurrent boot in runlevel S.
 +Cleaning up ifupdown....
 +Setting up networking....
 +Activating lvm and md swap...done.
 +Checking file systems...fsck from util-linux-ng 2.17.2
 +done.
 +Mounting local filesystems...done.
 +Activating swapfile swap...done.
 +Cleaning up temporary files....
 +Setting kernel variables ...done.
 ... ...
 +Cleaning up temporary files....
 +INIT: Entering runlevel: 3
 +Using makefile-style concurrent boot in runlevel 3.
 +Starting OpenBSD Secure Shell server: sshd.
 +
 +Debian GNU/Linux 6.0 ct1 console
 +
 +ct1 login: ​
 +</​code>​
 +
 +Observam ca terminalul este atasat la container, acesta fiind pornit in **foreground**.
 +
 +Pentru a va loga in container, folositi credentialele **root** / **root**.
 +
 +Vom opri containerul din interiorul acestuia, ca pe orice statie Linux, folosind ''​halt'':​
 +<code bash>
 +root@ct1:~# halt     
 +
 +Broadcast message from root@ct1 (console) (Sun Apr 13 18:22:16 2014):
 +
 +The system is going down for system halt NOW!
 +INIT: Switching to runlevel: 0
 +INIT: Sending processes the TERM signal
 +root@ct1:~# Using makefile-style concurrent boot in runlevel 0.
 +mount: / is busy
 +root@saisp-vm-1:​~#​
 +</​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**.
saisp/labs/07/contents/02.1384123598.txt.gz ยท Last modified: 2014/04/13 21:11 (external edit)
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0