LXC Host X Server Sharing

To launch a desktop application from the host,

    $ function lxc-launch() {
    >   sudo lxc-attach --clear-env -n $CONTAINER -- sudo -u ubuntu -i env DISPLAY=$DISPLAY $@
    > }

    $ CONTAINER=ubuntu-dev lxc-launch firefox

To launch an application from inside an lxc terminal session.

    $ lxc-console -n $CONTAINER
    # login to your user account
    $ export DISPLAY=:0 # or whatever host $DISPLAY variable is set to.
    $ inkscape


This post is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License