Article about running accelerated GUI apps in LXD

tl;dr:

We set up the container to have access to both /tmp/X11-unix/X0 and ~/.Xauthority of the host. And that’s it.
I did not see any need for other files file /dev/video0, etc. Works for me, Intel GPU.

Link: https://blog.simos.info/how-to-run-wine-graphics-accelerated-in-an-lxd-container-on-ubuntu/

I’m surprised that you didn’t need:

lxc config device add container-name gpu gpu

To have the needed /dev/dri/* entries that are required for accelerated graphics.

glxinfo I believe only pokes the X server for the information, but an actual GL application will then open /dev/dri through mesa.

It really mystified me that I would get the graphics performance without adding the gpu device.

I tried glxgears (still, without the gpu device, Intel GPU):

ubuntu@wine-games:~$ ls -l /dev/dri
ls: cannot access '/dev/dri': No such file or directory
ubuntu@wine-games:~$ glxgears
Running synchronized to the vertical refresh.  The framerate should be
approximately the same as the monitor refresh rate.
356 frames in 5.0 seconds = 71.028 FPS
300 frames in 5.0 seconds = 59.981 FPS
300 frames in 5.0 seconds = 59.981 FPS

A reader in the blog post reported that it did not work for them, and I suggested they try adding the gpu device.

I run LXD 2.13 with an Intel GPU.