Running a xorg server + graphical environment in container without any server or graphical libs on host

Hello,

My use case:

  • a container is created specifically to run a single X application
  • xorg not running on host as “baremetal” OS need to be kept as lean as possible

Is it possible to have the container connect to the display without having to go through a X server installed on host? I guess it would require exposing the video hardware to the container. Any pointer on how to do that?

https://blog.simos.info/how-to-easily-run-graphics-accelerated-gui-apps-in-lxd-containers-on-your-ubuntu-desktop/ fails to address this as the container cannot be launched if the host do not provide x related libraries.

Thank you for your help,
D

I suppose you want to run the Xorg server from within the container, while there is no X server on the host.

This is a very specific case and I have not seen any report of it working.
Having said that, it should be possible to make it work with a bit of effort and then write a blog post about it.

There is another recent thread on this specific issue, so have a look there as well and join the discussion.

You can use X2Go to run remote applications without installing stuff on the host:

Install Linux desktop with RDP or VNC in your container(s):

Thats more or less what my CIAB Remote Desktop System does

After installation nothing is runnung in the host but LXD and 2 LXD containers, one for management one for Desktop.

It uses Guacamole, tomcat, mysql, nginx, xrdp.

Its primarily for setting up cloud based remote desktops but you could use it locally.

1 Like

i am wanting to do roughly this kind of thing on my laptop. that means i want to use the actual hardware. my intention for containers is to have one for Ubuntu desktop and another for Ubuntu server, multiplied by as many versions as i want to keep (typically 2 or 3). these will be maintained reference containers doing nothing more than regular upgrades to stay up to date. then there will be production containers for various things to do with as much of the system files accessed in read-only mode (mounted R/O view of the reference container, if i can, else copied files). one of the production containers is where i will need to run Xorg. so it will need access to the hardware in the way Xorg does that, which i know nothing about (so i am tempted to try strace of Xorg to see what it does).

the idea of R/O everything is for safer operation and usage. no accidental overwrites of system files. FYI, i keep all my files in my home directories in R/O. i’ve done this for decades (since my mainframe days). i have run R/O systems before using R/O optical media. i think containers can make this better if the Xorg issue can be resolved (though for servers, it’s a non-issue).

the reference containers is where i will do apt-get and other distribution upgrades. new versions will go in new containers. i’ll probably need to write an installer script to initialize the version of Ubuntu into the empty container.

the host system will be minimal, just barely enough to bring up the containers and let me admin it via VTY (no sshd, no network listeners). i do not want to run Xorg directly on the host though i may have to do that for a while.

can this concept be run under LXD? or partly under LXD (such as the production containers), or will i need LXC? where should i try to get Xorg running?