Docker installation

x86/x64

Enabling CUDA in a Docker container

nvidia-smi

nvidia-smi.png

docker run --rm **--gpus all** nvidia/cuda:12.3.1-base-ubuntu20.04 nvidia-smi

Access to X Server (for graphics) - temporary and unsafe solution

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: