[Lxc-users] starting multiple containers running an application using a shell script

Serge Hallyn serge.hallyn at canonical.com
Wed Jun 6 16:23:20 UTC 2012


Quoting Massimo Cafaro (massimo.cafaro at unisalento.it):
> Dear all,
> 
> I am new to lxc and I am using it on Fedora 16.
> I need to run a simulation with multiple nodes, each running a p2p application. So far, I have been able to manually start the containers (one for each opened shell), providing a simulated network through the ns-3 simulator, and launching on each container the p2p application. Everything works, but now I need to move from just a few containers to many (hundreds) containers. Therefore, I am trying to write a shell script to automatically start the containers with the application.
> 
> However, I am facing various problems. If I start a container in daemon mode, then I am not able to connect through lxc-console, even if I try using a tty and not the console. 

Do you mean that if you do

	for i in `seq 1 3`; do
		lxc-start -n host-$i -d &
	done

you can't then do

	lxc-console -n host$i

?  If so, then that is a bug.  It works for me.

> If I start a container using screen, like this
> 
> /usr/bin/screen -dmShost-$i /usr/bin/lxc-start -n host-$i
> /usr/bin/lxc-wait --name=host-$i --state=RUNNING
> 
> then I am not able to start the application.
> 
> I have altro tried using lxc-execute, but the application is not started.
> 
> Can you please provide me with a very simple shell script starting a few containers in a loop, and running an example application (so that I can test the app is actually running)?
> 
> Thank you in advance.
> With kind regards,
> 
> Massimo Cafaro
> 
> 
> 
> - 
> 
> *******************************************************************************************************
> 
>  Massimo Cafaro, Ph.D.                               Additional affiliations:
>  Assistant Professor                                      Euro-Mediterranean Centre for Climate Change
>  Dept. of Engineering for Innovation          SPACI Consortium  
>  University of Salento, Lecce, Italy             E-mail massimo.cafaro at unisalento.it
>  Via per Monteroni                                                     massimo.cafaro at cmcc.it
>  73100 Lecce, Italy					                                cafaro at ieee.org
>  Voice/Fax  +39 0832 297371 				                        cafaro at acm.org   
>  Web     http://sara.unisalento.it/~cafaro                                                                 
>        
> 
> *******************************************************************************************************
> 
> 
> 
> 
> 
> 



> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and 
> threat landscape has changed and how IT managers can respond. Discussions 
> will include endpoint security, mobile security and the latest in malware 
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/

> _______________________________________________
> Lxc-users mailing list
> Lxc-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lxc-users





More information about the lxc-users mailing list