Issue installing NVIDIA driver on my container due to Ubuntu specific Nvidia driver on my host machine

Hello everyone,

I am setting up a container with a graphics card share and NVIDIA drivers installed.

My host machine is running Ubuntu 22.04 and I’m trying to run an Ubuntu 20.04 container.

As far as I know, in order to get the NVIDIA drivers to work, you have to share the graphics card (no problem there), then install exactly the same NVIDIA driver as on the host machine, without the kernel modules.

Normally this poses no problem and works correctly, but the drivers installed on my host machine were installed using the Ubuntu utility.

It installed version 550.54.15, which according to is a specific version of the driver specially designed for Ubuntu 22.04.

Looking in the NVIDIA drivers archives Official Advanced Driver Search | NVIDIA (I have an rtx 4060 notebook) I can’t find the version installed on my host machine but only the version 550.54.14 which of course doesn’t work when I try to install it on my container as it’s a different version from the one on the host machine.

I therefore tried to install version 550.54.15 designed for Ubuntu 22.04 on the container by downloading the .deb file from the first link. The installation went without a hitch, but even if the package is installed correctly, the drivers don’t seem to be present on the container, because I can’t run the nvidia-smi command, which doesn’t exist.

Have you ever found yourself in this kind of situation?

Do you have any idea of what I could try to do in order to have working drivers on my container?

Thanks in advance


The old way (I think about 5-6 years ago) was to manually install the drivers in each container.
NVidia though provides a container runtime and Incus is able to auto-magically install that runtime for you. The runtime matches the version of whichever driver you are running on the host.
See the Instance options on how to enable the NVidia container runtime.

Oh …
Wonderful, that just work immediately.
As you said magically, thanks !