Docker, Error: OpenGL 4.4 context creation failed

Hi!
I have a strange problem with OpenGL. When I start an application (which uses opengl) from docker container, I got an error:

Error: OpenGL 4.4 context creation failed. You could try updating your graphics drivers.

It worked for me even yesterday, so I though that last update caused the error:

[2021-12-14T21:47:50+0100] [ALPM] upgraded nvidia-container-toolkit (1.5.1-1 -> 1.7.0-1)
[2021-12-14T21:47:50+0100] [ALPM] upgraded visual-studio-code-bin (1.63.0-1 -> 1.63.1-1)
[2021-12-14T21:47:21+0100] [ALPM] upgraded libnvidia-container-tools (1.5.1-1 -> 1.7.0-1)
[2021-12-14T21:47:21+0100] [ALPM] upgraded libnvidia-container (1.5.1-1 -> 1.7.0-1)
[2021-12-14T21:47:01+0100] [ALPM] upgraded inxi (3.3.09.1-2 -> 3.3.10.1-1)

I’ve downgraded nvidia-container-toolkit, libnvidia-container and libnvidia-container-tools, but it didn’t help. Any ideas what could be the root cause?

Would have been helpful if you pasted the docker command.

Try this…

docker run -it --rm \
$(ls /dev | grep nvidia | sed 's/^/--device \/dev\//') \
repo/image:tag

Thanks for hint. As I’m testing more, it seems that there is a problem with installation of OpenGL on top of nvidia/cuda:11.4.2-devel-ubuntu20.04 image, in this case it doesn’t work.
As I run with nvidia/opengl:1.2-glvnd-devel-ubuntu20.04:

docker run --gpus all --rm -it -v /dev:/dev --net=host -e DISPLAY=:0 --privileged=true nvidia/opengl:1.2-glvnd-devel-ubuntu20.04 bash

GL app runs as should. So probably I should install CUDA on top of NVIDIA OpenGL image. I’ll check it.

Thanks for hint. As I’m testing more, it seems that there is a problem with installation of OpenGL on top of nvidia/cuda:11.4.2-devel-ubuntu20.04 image

You’ll want the CudaGL images then.

Right, CudaGL solves my issue, I didn’t notice this type of image.
Still don’t know why previously it worked on pure CUDA image, maybe something changed in my code as I merged git branches, I’ll try to investigate it more. Fortunately, it works now :slight_smile:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.