Further in the article we will use
demo as the user in the host and
ubuntu in the container.
Add the below lines to the LXD container config to allow the container's X11 to connect to the host:
devices: Xauthority: path: /home/ubuntu/.Xauthority source: /home/demo/.Xauthority type: disk
Forward the X11 socket to the container:
devices: X0: path: /tmp/.X11-unix/X0 source: /tmp/.X11-unix/X0 type: disk
Forward the gpu device:
device: mygpu: gid: "1000" type: gpu uid: "1000"
We will forward ALSA audio system. Go to /dev/snd and list all devices in the directory. Forward all of them as unix-char. Below is an example of one of the devices:
device: hwC0D0: gid: "29" path: /dev/snd/hwC0D0 type: unix-char
Forward /dev/snd/by-path as
device: sndbypath: path: /dev/snd/by-path source: /dev/snd/by-path type: disk