[Lxc-users] Launch multiple apps in exactly on container

Jue Hong honshj at gmail.com
Thu Sep 16 08:56:50 UTC 2010


Sure Daniel, what you say actually works. But I still want to know,
whether I can launch another app into a running container.

Doing as you say:
> lxc-execute -n foo /bin/bash  -- this bash runs inside container 'foo'
> lxc-execute -n bar /bin/bash  -- this bash runs inside container 'bar'
the 2nd bash will run in a different container named 'bar': e.g.
/dev/cgroup/bar.
What if I want to launch another app, like helloworld, inside the
first running container 'foo'?

Thanks!

On Thu, Sep 16, 2010 at 4:24 PM, Daniel Lezcano <dlezcano at fr.ibm.com> wrote:
> On 09/16/2010 09:36 AM, Jue Hong wrote:
>>
>> As I understand, running one application with the command lxc-execute
>> will create a container instance. E.g., by running lxc-execute -n foo
>> /bin/bash, a container named foo will be created, and I can find a foo
>> directory under the mounted cgroup directory, like /dev/cgroup/foo.
>> While retype lxc-execute -n foo /bin/bash, I'm told that:lxc-execute:
>> Device or resource busy.
>>
>> Does it mean I cannot run multiple apps within exactly the same
>> container foo via using lxc-execute or lxc-start? Or what should I do
>> if it's possible?
>
> The name is unique for the container. You can not start a container if it is
> already running. In your case you should do:
>
> lxc-execute -n foo /bin/bash
> lxc-execute -n bar /bin/bash
>
> If you want to use the same configuration for both, you can supply these to
> the command line with the -f option.
>
> lxc-execute -n foo -f lxc.conf /bin/bash
> lxc-execute -n bar -f lxc.conf /bin/bash
>
> You can also pass the configuration parameters with:
>
> lxc-execute -n foo -s lxc.utsname=foo /bin/bash
> lxc-execute -n bar -s lxc.utsname=bar /bin/bash
>
> Cheers
>  -- Daniel
>

Jason




More information about the lxc-users mailing list