If you want to have a GUI inside your Container there are multiple methods to achieve this.
Factors to consider include:
- GPU acceleration (needed for demanding applications such as Games, Editing-, Rendering programs etc.)
- Security (in terms of seperation between Host and Container)
With GPU acceleration:
- Use the Host’s Wayland Server (including XWayland): How to use the Host's Wayland and XWayland Servers inside containers
This can also be used by X-Server users, because (some) Wayland compositors can run on X-Servers and include compatibility for X-Applications through XWayland.
Regarding Security: More secure because of the way Wayland works.
- Use the Host’s X-Server: Described in simos blog: https://blog.simos.info/running-x11-software-in-lxd-containers/
Regarding Security: Insecure because of the way X-Server works.
Consider using the Wayland method above, which also works on X-Servers.
Without GPU acceleration:
- Use X2Go (especially useful for remote desktops): https://blog.simos.info/how-to-use-the-x2go-remote-desktop-with-lxd-containers/
Regarding Security: More secure because it runs seperate from the Host’s X-Server.
- Overview by simos: https://blog.simos.info/discussion-on-running-x11-applications-from-within-lxd-system-containers/
Overview in X11docker github repo by mviereck: https://github.com/mviereck/x11docker/wiki/X-server-and-Wayland-Options#attributes-of-x-server-and-wayland-options
These might be transferable to LXD.