Can we install a docker image nvidia/cuda without installing anything on the host?

Every time I’m installing a Linux with CUDA development, it’s a real hassle with the wrong versions of drivers / Linux kernel / etc. and I spend a few hours.

So I thought about using a ready-to-use Docker image instead, such as docker pull nvidia/cuda:11.4.0-devel-ubuntu18.04.

Question: can I use such a pre-made container and not install any Nvidia-related driver/packages on the host and let everything be done in the docker container?

The answer seems to be “no” because when I do

sudo docker run --rm --gpus all nvidia/cuda:11.4.0-devel-ubuntu18.04 nvidia-smi

I get errors like initialization error: nvml error: driver not loaded: unknown..

Are drivers such as apt install nvidia-drivers-495 mandatory also on the host computer or only in the docker container (guest)?

Thanks


PS: even after installing apt install nvidia-drivers-495 on the host, I get nvidia-smi: NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running..