How to run a containerized Desktop Environment in a Window?

I got some sort of working solution now - unfortunately it seems to be highly unstable (see below for further information on this):

How it (sort of) works as of now:

  1. After the user made their choice, Tins creates a new container given the selected criteria and applies the generic X11 and the specific Desktop Environment profile (e.g: for X11 this, and for GNOME this one)
  2. The container creation process of LXD downloads the latest available, matching image from images.linuxcontainers.org (e.g.: images:ubuntu/bionic/cloud)
  3. The desktop specific profile provides a cloud-init script, so this gets executed upon container start which downloads, installs and configures the desktop environment (e.g.: for GNOME this one).
  4. If the user wants to open a desktop enabled container, Xephyr is started at an available $DISPLAY number
  5. In the container systemctl start display-manager is executed and LightDM forwards its output to Xephyr

… overall it seems we have to be rather lucky if everything goes well. Which leads me to the problems I encounter:

Problems with this approach:

  1. The images from images.linuxcontainers.org seem to be highly unstable. Sometimes networking does not work, at other times apt is broken, etc…
  2. cloud-init takes very long to complete the initial setup because it needs to download all desktop packages
  3. cloud-init often fails to install the needed packages due to various reasons (e.g. failed to unpack package, connectivity issues, …)
  4. I was not able to find a good way to monitor cloud-init's progress and exit status - so as of now it is impossible to say when it is finished which leads to a bad user experience
  5. Xephyr runs completely independent from Tins so its just fire and forget - hoping everything goes well

Any help to mitigate these issues and/or improve the overall process would be highly appreciated

I’m also wondering if it is possible to build and publish out-of-the-box, desktop environment enabled images to images.linuxcontainers.org (or some other public mirror)? This would save a ton of bandwith, and would probably dramatically improve the success rate of setting such a container up.

In case you want to experiment yourself

Feel free to clone the project from GitHub, as of now Ubuntu Focal and Ubuntu Bionic are the only two Desktop Environment enriched Distro flavours.

2 Likes