nvidia-smi
--gpus all
docker run --rm **--gpus all** nvidia/cuda:12.3.1-base-ubuntu20.04 nvidia-smi
docker run -it --gpus all --env DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix ubuntu:tests
--env DISPLAY=$DISPLAY
→ Sets DISPLAY environment variable value to be the same as HOST's
-v /tmp/.X11-unix:/tmp/.X11-unix
→Helps in X11 forwarding so that we can use functions like cv::imshow
To allow the access to the XServer, the solution should be through tocken authentication porpouses. To make it easier, but quite unsafe, we can disable and enable the XServer authentication: