Nvidia GPU Passthrough to Linux Container w/ Ubuntu 20.04 (Full Desktop)

The ‘gpu gpu’ means add a device called gpu that’s of type gpu. When no property is set after that, it tells LXD to just pass in whatever the host has.

To simplify launch you could do:

  • lxc profile create nvidia
  • lxc profile set nvidia nvidia.runtime true
  • lxc profile device add nvidia gpu gpu

Then you can just do ‘lxc launch images:ubuntu/20.04 u1 -p default -p nvidia’

That will create a container with both the default and nvidia profiles applied.