Multiple Desktop Environments with LXC
5 March, 2021 by
Multiple Desktop Environments with LXC
| No comments yet

This repository contains a Debian source package which you can build and install on your host to make it piss simple to run multiple LXC instances with graphical desktop environments in parallel on a single host. Each LXC instance will occupy a separate virtual terminal (VT), so you can switch between them using Ctrl-Alt-Fn keys. Each instance also shares direct access to the graphics hardware and other privileges for performance and flexibility.

This is no security measure, but a way to share an expensive resource like a laptop computer. Think of isolated work and private environments, or multiple users.

Quick start on a Ubuntu 14.04 host

git clone && cd lxc-desktop
sudo apt-get install ubuntu-dev-tools debhelper
dpkg-buildpackage -uc -us
sudo dpkg -i ../lxc-desktop_*_all.deb
sudo apt-get -f install

If you want to speed up the creation and updating of the host system and desktop containers using apt-cacher-ng(8), simply install the lxc-desktop-cache package.

sudo dpkg -i ../lxc-desktop-cache_*_all.deb
sudo apt-get -f install

Now you’re ready to create the first desktop container:

sudo lxc-create -n container -t ubuntu-desktop
sudo lxc-start -n container -d

Within a few seconds you should get a graphical Ubuntu Desktop login screen on the next available virtual terminal.

Adding packages

The template only installs the ubuntu-desktop package by default, a very, very minimal desktop environment. You may want to add additional packages when you create the container.

sudo lxc-create -n container -t ubuntu-desktop -- \

Run lxc-create -n container -t ubuntu-desktop -- --help for template usage instructions.

Sign in to leave a comment