Docker NVIDIA on bullseye

Docker NVIDIA on bullseye

We're about to see Bullseye release soon and a few days ago there was this message from Debian maintainers that among other things said:

If you are in a position to carry out upgrade testing from buster to bullseye in the field, now is the time to do so and send your feedback as a bug report against the "upgrade-reports" pseudo-package.:

So I jumped in, and honestly it was flawless, everything worked out-of-the box, except one thing, but it's not on Debian's maintainers fault, it's ....well NVIDIA, again...

As you may know, you can access your NVIDIA GPU in docker containers, for that you need to install the nvidia-docker package (with the super clever command sudo apt install nvidia-docker2 yes this is it !).

Now with Bullseye (Arch users apparently face the same issue) the issue is two-fold:

  • 1st NVIDIA didn't catch with bullseye yet, so only debian10 (Buster) is supported in their sources.list as the time of writing, not a big deal but you have to hack the installation process and make as if your distribution was debian10.
  • 2nd, even if it was supported, Bullseye comes in with cgroups v2 by default, which NVIDIA does not support...yet !

So, if you want your containers to be able to use the GPU, in my case it's a Plex container so that transcoding is performed by the hardware you have to do 1 thing:

  • Edit your grub file /etc/default/grub and disable the cgroups hierarchy adding systemd.unified_cgroup_hierarchy=0 to the GRUB_CMDLINE_LINUX_DEFAULT
  • Don't forget to sudo update-grub and reboot

You might also want to follow this issue so that you're able to remove that once they provide cgroups v2 support !

Oh and I could not resist but: