Accessing gpu with container with usernamespace mapping

Hello there I’m trying to improve our project containerisation by using user namespaces. The problem is one of the container using cuda and it used to work just fine with runtime: nvidia but when I add the “userns-remap”:“username” to /etc/docker/daemon.json and restart docker or reboot the device it fails to find cuda inside the container. I have tried mounting /dev/nvidia* resources too but to no avail. If anyone knows how to achieve this guidance would be much appreciated. Thank you.

Device is nvidia jetson orin nano with jetpack 5.1.2. The said container uses dustynv/l4t-pytorch:r35.4.1 as base image and was working fine until usernamespace mapping.

You could try the documentation of Nvidia for Rootless containers

If it works with rootless Docker, which also uses user namespaces, then maybe it works with only usernamespaces too.