OpenVZ Forum


Home » General » Support » question about copying container (container creation)
question about copying container [message #48750] Fri, 16 November 2012 00:43 Go to next message
Viacob is currently offline  Viacob
Messages: 7
Registered: November 2012
Junior Member
is there any way to copy a container into say 300 new containers? Or do they have to all be set up individually?

Thanks
Vlad
Re: question about copying container [message #48751 is a reply to message #48750] Fri, 16 November 2012 16:18 Go to previous messageGo to next message
amissus is currently offline  amissus
Messages: 21
Registered: November 2011
Location: Czech Republic - Ostrava
Junior Member
Yes, you can do so. You can copy private area and config file, of course you have to do some essential modifications in new copied container as redefine hostname, ip, private and root path if it is hard defined and so on ...
Re: question about copying container [message #48752 is a reply to message #48751] Fri, 16 November 2012 18:07 Go to previous messageGo to next message
Viacob is currently offline  Viacob
Messages: 7
Registered: November 2012
Junior Member
ok that works. but theres no way to creat a new container from an already pre exisiting?

thanks!
Re: question about copying container [message #48753 is a reply to message #48750] Fri, 16 November 2012 21:16 Go to previous messageGo to next message
amissus is currently offline  amissus
Messages: 21
Registered: November 2011
Location: Czech Republic - Ostrava
Junior Member
What do you mean by "creat a new container from an already pre exisiting"? When you copy one container to other, you have two containers with same state, no more, no less.
Re: question about copying container [message #48754 is a reply to message #48753] Fri, 16 November 2012 21:18 Go to previous messageGo to next message
Viacob is currently offline  Viacob
Messages: 7
Registered: November 2012
Junior Member
What i meant is create a whole new container with the same exact contents as the previous. for example i am going to run 300 vms and want the 1rst one to be a template once its all set up for the other 299
Re: question about copying container [message #48755 is a reply to message #48750] Sat, 17 November 2012 01:03 Go to previous messageGo to next message
Ales is currently offline  Ales
Messages: 330
Registered: May 2009
Senior Member
What amissus explained is basically this - you can use an existing precreated OS template to make the first container, start it up, make all needed modifications (if you need to) and than save it as an OS template again. And than use it for the next 299, of course.

OpenVZ has an extensive wiki and this is explained here:

http://wiki.openvz.org/Fedora_template_update
http://wiki.openvz.org/Updating_Debian_template

Besides the OS template, all a container needs is a textual configuration file. If you want to generate containers and later modify all 299 or 300 of them automatically, a little bash scripting (or python, perl, whatever floats your boat) will do the job just nicely, directly or by using vzctl in your script.

[Updated on: Sat, 17 November 2012 01:06]

Report message to a moderator

Re: question about copying container [message #48756 is a reply to message #48755] Sat, 17 November 2012 01:39 Go to previous messageGo to next message
Viacob is currently offline  Viacob
Messages: 7
Registered: November 2012
Junior Member
perfect that was what i was thinking! i appreciate the help Mad
Re: question about copying container [message #48757 is a reply to message #48750] Sat, 17 November 2012 08:55 Go to previous messageGo to next message
amissus is currently offline  amissus
Messages: 21
Registered: November 2011
Location: Czech Republic - Ostrava
Junior Member
Yes, as Ales said, It is what you want.

I have a few "template" containers which I keep up to date and when I want new "production" or "testing" container, I simply copy one of template one. OS template is actually only archived private area. It saves space and it is more "uniform" but I am not using it.

Modify config file for many CTs when using "copy" method by some type of script must be easy for person, who is playing with OpenVZ Smile
Re: question about copying container [message #48777 is a reply to message #48750] Wed, 21 November 2012 01:06 Go to previous message
mustardman is currently offline  mustardman
Messages: 91
Registered: October 2009
Member
I do this all the time. As others said, just create a template. One of the advantages of OpenVZ.
Previous Topic: Why does my total memory used not match all process rss sum?
Next Topic: Host CPU system time keep growing
Goto Forum:
  


Current Time: Fri Nov 08 17:01:00 GMT 2024

Total time taken to generate the page: 0.00448 seconds