Docker Container Runtime not found unless build is root

When I try to run a docker container with the nvidia runtime, I get the error below:

docker: Error response from daemon: unknown or invalid runtime name: nvidia

unless I preface the command with “sudo”.

Here are two sample docker run commands that give this error:

docker run -it --gpus all --runtime nvidia nvidia/cuda:11.4.0-base-ubuntu20.04 nvidia-smi

docker run --rm --runtime=nvidia --gpus all ubuntu nvidia-smi

I ran this on a new Ubuntu 24.04 install with an NVIDIA 1660 Super with the 550 drivers.

I followed the instructions here to install the NVIDIA Container Toolkit (“Installing from APT”, “Configuring Docker” and “Rootless Mode”).

Docker and Docker Desktop are the latest versions, installed via apt. I even added the runtime section to the $HOME/.docker/daemon.json file, but no luck.

I’d appreciate any help.

so I gave up, and just run the container rooted using portainer to manage it