I have been working with docker, nvidia gpus and Display before in docker image. Inside which I am successfully able to initialize
pygame.init()
with output (7,0)
After formatting my ubuntu machine. I installed docker and nvidia container toolkit to enable gpus inside the docker container.
however after I use xhost +
and run following docker command and bash to running container.
docker run -it -e DISPLAY=$DISPLAY --gpus all <IMAGE ID>
Inside the container. I can see nvidia-smi
working and nvcc --version
working. And installed
apt-get install -qqy x11-apps
. However when I install pygame using pip install pygame
And initialize pygame with pygame.init()
it throws me an error:
pygame.error: No available video device
I have already gone though: pygame.error: No available video device
and many other link.
Would like to know if I am missing any libraries. On host machine or inside docker container and for reference I am using following container
docker run -it -e DISPLAY=$DISPLAY --gpus all nvcr.io/nvidia/tensorflow:20.06-tf2-py3
Other commands which I already have tried thanks to Stackoverflow community are following docker run -it -e DISPLAY=$DISPLAY -v SOME UNIX SOCKET MOUNT --gpus all nvcr.io/nvidia/tensorflow:20.06-tf2-py3
How do I connect my display to pygame so pygame.init() or pygame.display.init() does not break inside docker container.
Note: Python version 3
UPDATE 1: I tried without gpus all option
docker run -it -e DISPLAY=$DISPLAY nvcr.io/nvidia/tensorflow:20.06-tf2-py3
However it still does not work
UPDATE 2: https://opeonikute.dev/posts/running-pygame-in-a-docker-container-macos
Followed attempt 4 section of above article and I see following error
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
X Error of failed request: GLXBadContext
Major opcode of failed request: 152 (GLX)
Minor opcode of failed request: 6 (X_GLXIsDirect)
Serial number of failed request: 104
Current serial number in output stream: 103
Update 3: Problem might be here https://github.com/NVIDIA/libglvnd
Since pygame work in nvidia/opengl base image but I want to use base image for nvcr.io/nvidia/tensorflow:20.06-tf2-py3