[ Snap: LXD 3.18 ] Difficulty running OpenGL applications in container

IT WORKS!

Your work around is greatly appreciated! I now have glxgears working!
Thank you so much for your time in helping me with this problem!!

Closing Comments

Unfortunately, our project is built against ROS Kinetic Kame, which is built for Ubuntu 16.04 LTS.
So until then, I’ll be doing work inside Ubuntu Xenial containers, with this work around implemented in my profile.

Here is the profile for other readers to utilize, been tested and works well.
I decided to merge my gui and nvidia profiles together.

$ lxc profile show nvidia
config:
  environment.DISPLAY: :0
  nvidia.driver.capabilities: graphics, compute, display, utility, video
  nvidia.runtime: "true"
  raw.idmap: both 1000 1000
  user.user-data: |
    #cloud-config
    package_upgrade: true
    packages:
      - x11-apps
      - mesa-utils
    runcmd:
      - 'ln -s /usr/lib/x86_64-linux-gnu/libGLX_nvidia.so.418.87.01 /usr/lib/x86_64-linux-gnu/libGL.so.1'
      - 'ldconfig'
      - 'rm /etc/ld.so.conf.d/x86_64-linux-gnu_GL.conf'
      - 'ldconfig'
description: Enables GPU Pass-Through & X Forwarding
devices:
  Quadro-M100M:
    pci: "0000:01:00.0"
    type: gpu
  X0:
    bind: container
    connect: unix:@/tmp/.X11-unix/X0
    listen: unix:@/tmp/.X11-unix/X0
    security.gid: "1000"
    security.uid: "1000"
    type: proxy
name: nvidia
used_by:
- /1.0/containers/gui

Keeping in mind that this profile now makes the container driver specific…
I’m open to better alternatives to easily implement this work around for quick container launches.
For the time being, this will do nicely.