Error: no integrated GPU detected when running prime-select nvidia in container

I’m trying to run rviz2 (from ROS) inside of a container, but it seems to be ignoring my prime-select setting on the host machine and uses the intel graphics driver rather than the nvidia GPU.

Does the “prime-select” setting on the host propagate into containers?

As an experiment I started a container with the following command:

$ docker run -it --rm --gpus all nvidia/cuda:11.0.3-base-ubuntu20.04 /bin/bash

nvidia-smi works as expected, but prime-select shows a a different value than the host and won’t let me switch to nvidia:

root@280122db79cd:/$ apt-get install nvidia-prime
... snip ...
root@280122db79cd:/$ prime-select query
root@280122db79cd:/$ prime-select nvidia
Error: no integrated GPU detected.

Is this the expected output or should prime-select nvidia work inside of a container?

Nvidia bug report attached:

nvidia-bug-report.log.gz (374.1 KB)