GUI Apps in LXD container

Hi!

I suppose you only need the OpenGL libraries to be available in the container, and have access to the GPU from the container.

To give access to your GPU inside the container, you need to run (from the host) the following. If you have more than one GPU, you may need to add parameters that distinguish one from another.

lxc config device add mycontainer mygpu gpu

If you have an Intel or AMD GPU or Nvidia (nouveau), then you would need to install the corresponding GL libraries (mesa). Sorry, I do not have the proper list handy at the moment.

If you have an NVidia GPU (closed-source driver on the host), it used to be much harder but now it is apparently easier because Nvidia distributes a runtime and LXD can use it. In that case, you can run from the host,

lxc config set mycontainer nvidia.runtime true
lxc restart mycontainer