OpenVZ Forum


Home » Mailing lists » Users » OS/app in the OpenVZ container
OS/app in the OpenVZ container [message #44034] Thu, 10 November 2011 07:29 Go to next message
Tommy is currently offline  Tommy
Messages: 9
Registered: November 2011
Junior Member
Hi All,

I'm doing some research on processing virtual machine recently.

As I what know now, I think OpenVZ vps runs the same OS kernel as the
host system.
The vps is a group of processes which are forked on the host system.
In the OpenVZ container, thera are some processes to run an os.
Is it possible to run only one App in the container instead of the os
based on the host os? such as a media player?
what are work should I need to do mainly?
could you give me some suggestion?

Thanks.

Tommy
--

Yours Sincerely!
Re: OS/app in the OpenVZ container [message #44035 is a reply to message #44034] Thu, 10 November 2011 08:22 Go to previous messageGo to next message
Kirill Korotaev is currently offline  Kirill Korotaev
Messages: 137
Registered: January 2006
Senior Member
Yes, it's possible to run a single app in a container.
The easiest way is to let the startup scripts setup /proc, /sysfs and the rest of environment and then specify in inittab or rc.X what to run on this particular runlevel.

However, for media player you may also need to run some of X parts, not just a media player alone.

Thanks,
Kirill



On Nov 10, 2011, at 11:29 , Tommy wrote:

> Hi All,
>
> I'm doing some research on processing virtual machine recently.
>
> As I what know now, I think OpenVZ vps runs the same OS kernel as the host system.
> The vps is a group of processes which are forked on the host system.
> In the OpenVZ container, thera are some processes to run an os.
> Is it possible to run only one App in the container instead of the os based on the host os? such as a media player?
> what are work should I need to do mainly?
> could you give me some suggestion?
>
> Thanks.
>
> Tommy
> --
> Yours Sincerely!
>
>
>
> <ATT00001.c>
Re: OS/app in the OpenVZ container [message #44036 is a reply to message #44035] Thu, 10 November 2011 08:59 Go to previous messageGo to next message
Tommy is currently offline  Tommy
Messages: 9
Registered: November 2011
Junior Member
于 2011/11/10 16:22, Kirill Korotaev 写道:
> Yes, it's possible to run a single app in a container.
> The easiest way is to let the startup scripts setup /proc, /sysfs and the rest of environment and then specify in inittab or rc.X what to run on this particular runlevel.
>
> However, for media player you may also need to run some of X parts, not just a media player alone.
>
> Thanks,
> Kirill
>
>
>
> On Nov 10, 2011, at 11:29 , Tommy wrote:
>
>> Hi All,
>>
>> I'm doing some research on processing virtual machine recently.
>>
>> As I what know now, I think OpenVZ vps runs the same OS kernel as the host system.
>> The vps is a group of processes which are forked on the host system.
>> In the OpenVZ container, thera are some processes to run an os.
>> Is it possible to run only one App in the container instead of the os based on the host os? such as a media player?
>> what are work should I need to do mainly?
>> could you give me some suggestion?
>>
>> Thanks.
>>
>> Tommy
>> --
>> Yours Sincerely!
>>
>>
>>
>> <ATT00001.c>
>
hello,

I think I didn't describe my question clearly

If I want to start an app in the container, i should do the following step:
1.create a container ,start it and there is an Guest OS running in the
container now;
2.enter the container and start the app I want;

it acts as a system virtual machine

what i want to do is :
1.create the container
2.start the app in the container

this will act as a process virtual machine

any suggestion?

thanks

--

Yours Sincerely!
Re: OS/app in the OpenVZ container [message #44037 is a reply to message #44036] Thu, 10 November 2011 09:29 Go to previous messageGo to next message
Stoyan Stoyanov is currently offline  Stoyan Stoyanov
Messages: 11
Registered: November 2011
Junior Member
If thats right you just need to isolate the application process/
processes ? So may be the best way is just chroot it in the standard
linux way. of course u can set limits too, but i don't thing it's
possible in os-virtualization level to run only application?


On Nov 10, 2011, at 10:59 AM, Tommy wrote:

> 于 2011/11/10 16:22, Kirill Korotaev 写道:
> Yes, it's possible to run a single app in a container.
> The easiest way is to let the startup scripts setup /proc, /sysfs
> and the rest of environment and then specify in inittab or rc.X what
> to run on this particular runlevel.
>
> However, for media player you may also need to run some of X parts,
> not just a media player alone.
>
> Thanks,
> Kirill
>
>
>
> On Nov 10, 2011, at 11:29 , Tommy wrote:
>
> Hi All,
>
> I'm doing some research on processing virtual machine recently.
>
> As I what know now, I think OpenVZ vps runs the same OS kernel as
> the host system.
> The vps is a group of processes which are forked on the host system.
> In the OpenVZ container, thera are some processes to run an os.
> Is it possible to run only one App in the container instead of the
> os based on the host os? such as a media player?
> what are work should I need to do mainly?
> could you give me some suggestion?
>
> Thanks.
>
> Tommy
> --
> Yours Sincerely!
>
>
>
> <ATT00001.c>
>
> hello,
>
> I think I didn't describe my question clearly
>
> If I want to start an app in the container, i should do the
> following step:
> 1.create a container ,start it and there is an Guest OS running
> in the container now;
> 2.enter the container and start the app I want;
>
> it acts as a system virtual machine
>
> what i want to do is :
> 1.create the container
> 2.start the app in the container
>
> this will act as a process virtual machine
>
> any suggestion?
>
> thanks
>
> --
> <!-- @page { margin: 0.79in } P { margin-bottom: 0.08in } A:link
> { so-language: zxx } -->
> Yours Sincerely!
>
>
>
>
> <ATT00001.txt>

Stoyan Stoyanov
Core System Administrator




CONFIDENTIAL
The information contained in this email and any attachment is
confidential. It is intended only for the named addressee(s). If you
are not the named addressee(s) please notify the sender immediately
and do not disclose, copy or distribute the contents to any other
person other than the intended addressee(s).
Re: OS/app in the OpenVZ container [message #44038 is a reply to message #44034] Thu, 10 November 2011 10:33 Go to previous messageGo to next message
kir is currently offline  kir
Messages: 1645
Registered: August 2005
Location: Moscow, Russia
Senior Member

On 11/10/2011 11:29 AM, Tommy wrote:
> Hi All,
>
> I'm doing some research on processing virtual machine recently.
>
> As I what know now, I think OpenVZ vps runs the same OS kernel as the
> host system.
> The vps is a group of processes which are forked on the host system.
> In the OpenVZ container, thera are some processes to run an os.
> Is it possible to run only one App in the container instead of the os
> based on the host os? such as a media player?
> what are work should I need to do mainly?
> could you give me some suggestion?

It's pretty simple. What OpenVZ kernel does it creates a container and
runs /sbin/init inside it. What goes next is up to that particular
/sbin/init. If you need to run an app let /sbin/init run just it, or let
this app be /sbin/init (but bear in mind there will be no child reaper
as in usual linux system so you might need to take some extra care about
zombie processes).


Kir Kolyshkin
http://static.openvz.org/userbars/openvz-developer.png
Re: OS/app in the OpenVZ container [message #44040 is a reply to message #44037] Thu, 10 November 2011 10:36 Go to previous messageGo to next message
kir is currently offline  kir
Messages: 1645
Registered: August 2005
Location: Moscow, Russia
Senior Member

On 11/10/2011 01:29 PM, Stoyan Stoyanov wrote:
> If thats right you just need to isolate the application process/
> processes ? So may be the best way is just chroot it in the standard
> linux way.

This way you will only isolate the file system (and not in totally
inescapable way I must add). chroot() is essentially a file system
namespace, and there are a dozen of others in OpenVZ, and then a dozen
of resource limits.

> of course u can set limits too, but i don't thing it's
> possible in os-virtualization level to run only application?

It is possible. As I noted in another reply to this thread, OpenVZ
kernel just runs /sbin/init inside the container and assumes that init
will handle the rest.

>
>
> On Nov 10, 2011, at 10:59 AM, Tommy wrote:
>
> > 于 2011/11/10 16:22, Kirill Korotaev 写道:
> > Yes, it's possible to run a single app in a container.
> > The easiest way is to let the startup scripts setup /proc, /sysfs
> > and the rest of environment and then specify in inittab or rc.X what
> > to run on this particular runlevel.
> >
> > However, for media player you may also need to run some of X parts,
> > not just a media player alone.
> >
> > Thanks,
> > Kirill
> >
> >
> >
> > On Nov 10, 2011, at 11:29 , Tommy wrote:
> >
> > Hi All,
> >
> > I'm doing some research on processing virtual machine recently.
> >
> > As I what know now, I think OpenVZ vps runs the same OS kernel as
> > the host system.
> > The vps is a group of processes which are forked on the host system.
> > In the OpenVZ container, thera are some processes to run an os.
> > Is it possible to run only one App in the container instead of the
> > os based on the host os? such as a media player?
> > what are work should I need to do mainly?
> > could you give me some suggestion?
> >
> > Thanks.
> >
> > Tommy
> > --
> > Yours Sincerely!
> >
> >
> >
> > <ATT00001.c>
> >
> > hello,
> >
> > I think I didn't describe my question clearly
> >
> > If I want to start an app in the container, i should do the
> > following step:
> > 1.create a container ,start it and there is an Guest OS running
> > in the container now;
> > 2.enter the container and start the app I want;
> >
> > it acts as a system virtual machine
> >
> > what i want to do is :
> > 1.create the container
> > 2.start the app in the container
> >
> > this will act as a process virtual machine
> >
> > any suggestion?
> >
> > thanks


Kir Kolyshkin
http://static.openvz.org/userbars/openvz-developer.png
Re: OS/app in the OpenVZ container [message #44044 is a reply to message #44035] Thu, 10 November 2011 12:16 Go to previous messageGo to next message
mdfranz is currently offline  mdfranz
Messages: 3
Registered: July 2011
Junior Member

Tommy,

You might want to want to look at LXC as well. Although i agree that
is is pretty much impossible to run a single process, but it all
depends what you are trying to do...

(BTW, don't mean to start an LXC vs. OpenVZ flame was, because the
features/tools in VZ are much more mature but because LXC is fairly
primitive relative to VZ it might be an option)

- mdf

2011/11/10 Kirill Korotaev <dev@parallels.com>:
> Yes, it's possible to run a single app in a container.
> The easiest way is to let the startup scripts setup /proc, /sysfs and the rest of environment and then specify in inittab or rc.X what to run on this particular runlevel.
>
> However, for media player you may also need to run some of X parts, not just a media player alone.
>
> Thanks,
> Kirill
>
>
>
> On Nov 10, 2011, at 11:29 , Tommy wrote:
>
>> Hi All,
>>
>> I'm doing some research on processing virtual machine recently.
>>
>> As I what know now, I think OpenVZ vps runs the same OS kernel as the host system.
>> The vps is a group of processes which are forked on the host system.
>> In the OpenVZ container, thera are some processes to run an os.
>> Is it possible to run only one App in the container instead of the os based on the host os? such as a media player?
>> what are work should I need to do mainly?
>> could you give me some suggestion?
>>
>> Thanks.
>>
>> Tommy
>> --
>> Yours Sincerely!
>>
>>
>>
>> <ATT00001.c>
>
>
--
--
Matthew Franz
mdfranz@gmail.com
Re: OS/app in the OpenVZ container [message #44046 is a reply to message #44036] Thu, 10 November 2011 13:13 Go to previous messageGo to next message
rmello is currently offline  rmello
Messages: 15
Registered: October 2007
Junior Member
2011/11/10 Tommy <thfbjhkhtdx@gmail.com>

>
> I think I didn't describe my question clearly
>

<snip>


> what i want to do is :
> 1.create the container
> 2.start the app in the container
>
> this will act as a process virtual machine
>

1. vzctl start <container_id>
2. vzctl exec <container_id> <executable>

Where <executable> can be either an application or a script that will a)
run the application, b) detach from the shell. The <executable> has to be
present inside the container.

Another (possibly simpler) way is to simply have the executable be started
by one of your startup scripts. That way you wouldn't even have to worry
about detaching from the shell.

Roberto
Re: OS/app in the OpenVZ container [message #44084 is a reply to message #44040] Tue, 15 November 2011 07:50 Go to previous messageGo to next message
Stoyan Stoyanov is currently offline  Stoyan Stoyanov
Messages: 11
Registered: November 2011
Junior Member
You may wonna take a look at this:
http://qubes-os.org/Architecture.html

On Nov 10, 2011, at 12:36 PM, Kir Kolyshkin wrote:

> On 11/10/2011 01:29 PM, Stoyan Stoyanov wrote:
> If thats right you just need to isolate the application process/
> processes ? So may be the best way is just chroot it in the standard
> linux way.
>
> This way you will only isolate the file system (and not in totally
> inescapable way I must add). chroot() is essentially a file system
> namespace, and there are a dozen of others in OpenVZ, and then a
> dozen of resource limits.
>
> of course u can set limits too, but i don't thing it's
> possible in os-virtualization level to run only application?
>
> It is possible. As I noted in another reply to this thread, OpenVZ
> kernel just runs /sbin/init inside the container and assumes that
> init will handle the rest.
>
>
>
> On Nov 10, 2011, at 10:59 AM, Tommy wrote:
>
> > 于 2011/11/10 16:22, Kirill Korotaev 写道:
> > Yes, it's possible to run a single app in a container.
> > The easiest way is to let the startup scripts setup /proc, /sysfs
> > and the rest of environment and then specify in inittab or rc.X what
> > to run on this particular runlevel.
> >
> > However, for media player you may also need to run some of X parts,
> > not just a media player alone.
> >
> > Thanks,
> > Kirill
> >
> >
> >
> > On Nov 10, 2011, at 11:29 , Tommy wrote:
> >
> > Hi All,
> >
> > I'm doing some research on processing virtual machine recently.
> >
> > As I what know now, I think OpenVZ vps runs the same OS kernel as
> > the host system.
> > The vps is a group of processes which are forked on the host system.
> > In the OpenVZ container, thera are some processes to run an os.
> > Is it possible to run only one App in the container instead of the
> > os based on the host os? such as a media player?
> > what are work should I need to do mainly?
> > could you give me some suggestion?
> >
> > Thanks.
> >
> > Tommy
> > --
> > Yours Sincerely!
> >
> >
> >
> > <ATT00001.c>
> >
> > hello,
> >
> > I think I didn't describe my question clearly
> >
> > If I want to start an app in the container, i should do the
> > following step:
> > 1.create a container ,start it and there is an Guest OS running
> > in the container now;
> > 2.enter the container and start the app I want;
> >
> > it acts as a system virtual machine
> >
> > what i want to do is :
> > 1.create the container
> > 2.start the app in the container
> >
> > this will act as a process virtual machine
> >
> > any suggestion?
> >
> > thanks
>
> <ATT00001.txt>

Stoyan Stoyanov
Core System Administrator




CONFIDENTIAL
The information contained in this email and any attachment is
confidential. It is intended only for the named addressee(s). If you
are not the named addressee(s) please notify the sender immediately
and do not disclose, copy or distribute the contents to any other
person other than the intended addressee(s).
Re: OS/app in the OpenVZ container [message #44423 is a reply to message #44038] Wed, 07 December 2011 04:23 Go to previous message
Enrico Weigelt is currently offline  Enrico Weigelt
Messages: 31
Registered: July 2006
Member
* Kir Kolyshkin <kir@openvz.org> wrote:

> It's pretty simple. What OpenVZ kernel does it creates a container and
> runs /sbin/init inside it. What goes next is up to that particular
> /sbin/init. If you need to run an app let /sbin/init run just it, or let
> this app be /sbin/init (but bear in mind there will be no child reaper
> as in usual linux system so you might need to take some extra care about
> zombie processes).

ACK.

The probably easiest way is to take some minimal OS image, so you also
get a shell, libc, and essential setups (mounting /proc and /sys), etc.
You'll most likely also need some little setup stuff to let your app
communicate with the outside world (eg. routing, filesystem access, etc).

Doing this all completely on your own takes a lot of more efforts,
but makes a good learning project :)

Some time ago (left it aside due lack of time), I've been working on
an kind of nano-distro for such use-cases, built with my Briegel
buildsystem (it crosscompiles tiny images which only include the
really essential stuff) . If you're really interested, I'd dig it
out again.


cu
--
------------------------------------------------------------ ----------
Enrico Weigelt, metux IT service -- http://www.metux.de/

phone: +49 36207 519931 email: weigelt@metux.de
mobile: +49 151 27565287 icq: 210169427 skype: nekrad666
------------------------------------------------------------ ----------
Embedded-Linux / Portierung / Opensource-QM / Verteilte Systeme
------------------------------------------------------------ ----------
Previous Topic: Heavy Disk IO from a single VM can block the other VMs on the same host
Next Topic: More on making an OpenVZ template
Goto Forum:
  


Current Time: Tue May 07 01:19:12 GMT 2024

Total time taken to generate the page: 0.01606 seconds