Docker Community Forums

Share and learn in the Docker community.

Error accessing GPU within Docker container when using Google's Mediapipe repository

I created a Mediapipe docker image using the instructions here: https://google.github.io/mediapipe/getting_started/install.html#installing-using-docker.

I have installed the mesa drivers used for Mediapipe GPU support as instructed here: https://google.github.io/mediapipe/getting_started/gpu_support.html#opengl-es-setup-on-linux-desktop.

When I try to verify my OpenGl ES version using glxinfo command, I get the following erroneous results"

root@12d464c329d5:/mediapipe# glxinfo | grep -i opengl
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:  154 (GLX)
  Minor opcode of failed request:  6 (X_GLXIsDirect)
  Serial number of failed request:  54
  Current serial number in output stream:  53

When I ran the same command outside of my docker container, I got the following correct results:

yiningliu@yiningliu-GS65-Stealth-9SF:~$ glxinfo | grep -i opengl
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce RTX 2070 with Max-Q Design/PCIe/SSE2
OpenGL core profile version string: 4.5.0 NVIDIA 430.64
OpenGL core profile shading language version string: 4.50 NVIDIA
OpenGL core profile context flags: (none)
OpenGL core profile profile mask: core profile
OpenGL core profile extensions:
OpenGL version string: 4.6.0 NVIDIA 430.64
OpenGL shading language version string: 4.60 NVIDIA
OpenGL context flags: (none)
OpenGL profile mask: (none)
OpenGL extensions:
OpenGL ES profile version string: OpenGL ES 3.2 NVIDIA 430.64
OpenGL ES profile shading language version string: OpenGL ES GLSL ES 3.20
OpenGL ES profile extensions:

This has led me to suspect that I am not able to access my GPU resources properly within the Mediapipe docker I created. On top of this, I built my Docker image using the base image nvidia/cudagl:10.1-base, which can be found on DockerHub

However when I check my computer’s nvidia-smi, it indicates CUDA Version 5.0. When I check using nvcc --version, it says CUDA 7.5. I am wondering if I need to upgrade one or both of the CUDA versions to 10.1 to match the base image I’m using to build the Mediapipe image.

yiningliu@yiningliu-GS65-Stealth-9SF:~$ nvidia-smi 
Wed Jul 22 17:48:23 2020       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 430.64       Driver Version: 430.64       CUDA Version: 5.0      |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce RTX 207...  Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   51C    P8     4W /  N/A |    366MiB /  7982MiB |      9%      Default |
+-------------------------------+----------------------+----------------------+