Error nvidia docker daemon (wls2)


I have installed cuda (12.2) and cudnn(8.9.4) on WSL2. The tests work fine.

I want to virtualize an application with docker (Docker version 24.0.5, build 24.0.5-0ubuntu1~22.04.1) which requires the use of the gpu. Docker is connected to WSL2. I have previously installed NVIDIA CONTAINER TOOLKIT (1.14.1) and nvidia-container-runtime (3.14.0-1) and restart docker.

I get this response after the docker-compose command: Error response from daemon: unknown or invalid runtime name: nvidia.

I get the same response with this command: sudo docker run --rm --runtime=nvidia --gpus all ubuntu nvidia-smi

How to fix it ?

Thanks for your help