TensorFlow Cuda in Docker under WSL2 not wokring

Hello everyone,

I am writing here after days of reading on the internet searching for a way to get TensorFlow working inside a Docker container on WSL2.

I installed the latest NVIDIA driver on Windows 11 and configured the Docker Desktop to run with WSL2. On Ubuntu, I have installed the Nvidia Container Toolkit, following the instructions not to install drivers on Linux.

nvidia-smi is showing me the following output in WSL:

Running a docker container with the following command:

sudo docker run -it --rm -p 8888:8888 --gpus all tensorflow/tensorflow:latest-gpu-jupyter

And running:

import tensorflow as tf
tf.config.list_physical_devices()

results in the following error “external/local_xla/xla/stream_executor/cuda/cuda_driver.cc:282] failed call to cuInit: CUDA_ERROR_NOT_FOUND: named symbol not found”:

Running nvidia-smi in the same container results in the same result as running in on WLS.

Can anyone help me resolve this issue? I am already losing hope.

Hi there I have the same problem, although the problem first arrived when making docker on my host machine to use WSL backend. I needed to do this in order to use VS code, and attaching to the docker running in WSL.

I have just found a solution. I installed an older version of the Nvidia driver (552.44) from here: https://www.nvidia.com/Download/Find.aspx#. I installed it using the “perform a clean installation” option from the Custom (Advanced) installation menu.

Try it yourself, I hope it works on your end too.