Unable to access GPU from Docker container on WSL 2 with NVIDIA GeForce GTX 1050 Ti

I’ve been trying to run CUDA Docker containers with GPU support using WSL 2 on my Windows system, but I’ve encountered several issues. I would appreciate any help or guidance on how to resolve these problems.

System Information:

OS: Windows 11 Professionnel 64-bit (10.0, Build 22621) (22621.ni_release.220506-1250)
GPU: NVIDIA GeForce GTX 1050 Ti with Max-Q Design
NVIDIA driver version: 31.0.15.3141
CUDA version: 12.1
Issue Description:

I’ve followed the [NVIDIA WSL User Guide] and attempted various solutions to enable GPU support in Docker containers. However, when I try to run a container with GPU support, I either get error messages or the container hangs with no logs.

> docker run -it --gpus all nvidia/cuda:12.1.0-runtime-ubuntu22.04 nvidia-smi

docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: error during container init: error running hook #0: error running hook: exit status 1, stdout: , stderr: Auto-detected mode as ‘legacy’
nvidia-container-cli: initialization error: WSL environment detected but no adapters were found: unknown.

I also attached the dxdiag output.
DxDiag.txt (177.4 KB)

Additional Information

I have migrated from Windows 10 to Windows 11 Professional, and I suspect this might be causing some issues. I found a section in the documentation that mentions possible issues with Windows Insider Preview Builds and Windows 10 support.

Although my WSL version seems to be correct, I believe there might be some configuration issues due to the migration that need to be resolved.

I would appreciate any guidance on resolving the issue of accessing the GPU from Docker containers on my system. If there are any known issues or workarounds for systems that have migrated from Windows 10 to Windows 11, please let me know.

Thank you in advance for your help!

As this problem is not normal and I also find many ways to solve this(including downgrade my Docker Desktop to v4.16.3 which is mentioned in Docker - nvidia/cuda issues - “nvidia-container-cli: initialization error: WSL environment detected but no adapters were found: unknown.” - Docker Hub / Issue Tracking - Docker Community Forums and upgrade my Windows to Insider Version(now is Windows 11 Pro 23H2 10.0.22635 Build 22635).
But they all failed.My latest problem is shown in the following figure link problem figure.
However, I just noticed that my GeForce Game Ready driver is so old which is of a version on 2021. I tried to upgrade the GeForce Game Ready driver through the GeForce Game Ready App on the Window but it shows an error.
After that I followed the tutorial of GeForce Experience driver installation failed. How do I manually clean install the NVIDIA driver for my graphics card? | NVIDIA (custhelp.com) to install the latest GeForce Game Ready driver manually.The direct download link is Official Drivers | NVIDIA and you should select the driver version that matches your nvidia gpu.
Finally I can run the docker command with --gpu all option successfully.
Hope it helpful.
(As a new user for the forum,I am not allowed to upload figures to show the process.Sorry to make this reply not that vivid)