Cannot run the nbody container example

I was following the instructions here: https://docs.nvidia.com/cuda/wsl-user-guide/index.html to setup cuda on WSL.

Everything worked fine until I got to the point of running containers. I got the following error:

$ docker run --gpus all nvcr.io/nvidia/k8s/cuda-sample:nbody nbody -gpu -benchmark
docker: Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: process_linux.go:545: container init caused: Running hook #0:: error running hook: signal: segmentation fault, stdout: , stderr:: unknown.
ERRO[0000] error waiting for container: context canceled

The same happens when trying to run jupyter notebooks:

$ docker run -it --gpus all -p 8888:8888 tensorflow/tensorflow:latest-gpu-py3-jupyter
docker: Error response from daemon: OCI runtime create failed: container_linux.go:380: starting container process caused: process_linux.go:545: container init caused: Running hook #0:: error running hook: signal: segmentation fault, stdout: , stderr:: unknown.
ERRO[0000] error waiting for container: context canceled

Docker itself appears to be working fine:

$ docker run hello-world

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

Any idea what the issue is and how I can fix it?

Extra info if useful:

$ uname -srvmpio
Linux 5.10.43.3-microsoft-standard-WSL2 #1 SMP Wed Jun 16 23:47:55 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.2 LTS
Release:        20.04
Codename:       focal
PS C:\> [System.Environment]::OSVersion.Version

Major  Minor  Build  Revision
-----  -----  -----  --------
10     0      22000  0

can you have solved the problem? I need your help, thank you

Yes. The issue appears to have been with the way to install docker. If you install docker from within WSL, it’s unhappy. The right way to do it is to install docker on windows and as part of the setup process (or maybe it’s a setting you configure after install, I already forgot) you enable WSL support. (I probably threw in a few restarts here and there.)