[Lxc-users] how to use system container

Serge Hallyn serge.hallyn at canonical.com
Tue Feb 21 15:13:59 UTC 2012


Quoting allen (allen303allen at gmail.com):
> 2012/2/20 Serge Hallyn <serge.hallyn at canonical.com>:
> > Quoting allen (allen303allen at gmail.com):
> >> HI ALL:
> >>     My aim is to run a Graphical application in a container, then an
> >> user connect to the container with a GUI interface, so that he can see
> >> and operate the application.
> >>     As I want to separate all resources, I think I'll need a system
> >> container. Now I already use "lxc-create -n maverick-lxc-template -t
> >> maverick -f /tmp/maverick-template-network.conf" to create an Ubuntu
> >> template, start it and use lxc-console to get a console of it.
> >>     Now my question is:
> >>     1. If I want to run an application, do I have to install it in the
> >> system container first?
> >
> > no.
> Then how can I run that application, could you show me some examples?
> I mean, in a system container.

I'm sorry, I had misread this as asking whether you need to install it on
the system (i.e. the host).

Now, you *can* get around installing the application in the container by
binding in the binaries and libraries from the host, but I would recommend
installing the application in the container, yes.

> >>     2. How can I connect to the container with a GUI interface?
> >
> > It depends on how you've set up the container's network and where the
> > guest will connect from.
> >
> > If your container were using a veth connected to libvirt's virbr0, and
> > the application is available on port 9999, then your guest could simply
> >
> > ssh -L 9999:container_ip_addr:9999
> >
> > and then connect to port 9999 on his local host.  For instance, if you
> > were opening up vnc on :1 in the container, the container is
> Dose this mean I have to start vncserver in my system container?

yes

> Then I have some troubles on that, my template is a minimum system,
> the lack of a lot of library files make the job difficult.
> Do I need a more powerful template? How can I get that?

I don't know what you've started with.  Treat it the same way as installing
the application on the container's distribution if it were on the host...
yum for fedora, apt-get for debian/ubuntu, or git clone/configure/make
if you did it from scratch, etc.

-serge




More information about the lxc-users mailing list