[Lxc-users] how to use system container

Serge Hallyn serge.hallyn at canonical.com
Mon Feb 20 14:30:48 UTC 2012


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.

>     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
192.168.122.89, and your host is 10.0.1.1, then he would do

ssh -L 5951:192.168.122.89:5901 10.0.1.1

and then

vncviewer :51

You can also put the container straight onto your local network, but
the above works with how containers creation is usually shown.

-serge




More information about the lxc-users mailing list