run glxinfo and glmark2 failed inside docker container on JETSON-Xavier


I can run glxinfo and glmark2 successfully on JETSON-AGX-Xavier.
Then, I want to run glxinfo and glmark2 inside docker container on Xavier. But it failed.
This is what I did:

  1. pull ubuntu docker image: docker pull ubuntu
  2. adjust the permissions the X server host: xhost +local:root
  3. start ubuntu docker image with mounted a volume for the X11 unix socket and tegra library:
    docker run -it --env=“DISPLAY” --env=“QT_X11_NO_MITSHM=1” --volume=“/tmp/.X11-unix:/tmp/.X11-unix:rw” --volume=“/usr/lib/aarch64-linux-gnu/tegra:/usr/lib/aarch64-linux-gnu/tegra:rw” --privileged ubuntu:latest
  4. Inside docker container (as root):
    export LD_LIBRARY_PATH=“/usr/lib/aarch64-linux-gnu/tegra”:${LD_LIBRARY_PATH}
    Then I run “glxinfo”. But it get a “Segmentation fault (core dumped)”. glmark2 get the same result.

I use strace to trace glximage, and I got the following where it failed:
socket(AF_UNIX, SOCK_DGRAM, 0) = 7
connect(7, {sa_family=AF_UNIX, sun_path=@“nvidia90377c2b\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0”}, 66) = -1 ECONNREFUSED (Connection refused)
close(7) = 0
— SIGSEGV {si_signo=SIGSEGV, si_code=SEGV_MAPERR, si_addr=0x28860} —
+++ killed by SIGSEGV (core dumped) +++
Segmentation fault (core dumped)

I issue " lsof | grep nvidia90377c2b" on host (not from docker), it gives:
Xorg 7262 root 21u unix 0xffffffc39537f000 0t0 46650 @nvidia90377c2b@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ type=DGRAM
InputThre 7262 7271 root 21u unix 0xffffffc39537f000 0t0 46650 @nvidia90377c2b@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ type=DGRAM

What is that socket path? How can I resolve this issue?


Please check if you can follow the wiki site to get it work:


I use my way to get it to work instead of using nvidia-docker. This is what I did:
docker run -it --net=host --env=“DISPLAY” --env=“QT_X11_NO_MITSHM=1” --volume=“/tmp/.X11-unix:/tmp/.X11-unix:rw” --volume=“/lib/aarch64-linux-gnu:/lib/aarch64-linux-gnu:rw” --volume=“/usr/lib/aarch64-linux-gnu:/usr/lib/aarch64-linux-gnu:rw” --volume=“/usr/local/cuda:/usr/local/cuda:rw” --device=/dev/nvhost-ctrl --device=/dev/nvhost-ctrl-gpu --device=/dev/nvhost-prof-gpu --device=/dev/nvmap --device=/dev/nvhost-gpu --device=/dev/nvhost-as-gpu ubuntu:latest

Inside docker container:
export PATH=“/usr/local/cuda/bin”:${PATH}
export LD_LIBRARY_PATH=“/lib/aarch64-linux-gnu:/usr/local/cuda/lib64:/usr/lib/aarch64-linux-gnu:/usr/lib/aarch64-linux-gnu/tegra”:${LD_LIBRARY_PATH}
Then I can run glmark2 and and cuda sample apps with no issue.

However, I after reading your link, I have some question:

  1. It seems nvidia-docker and nvidia-docker2 are deprecated. And it strongly recommends to use Docker version 19.03, and install nvidia-container-toolkit, then just start docker image by “docker run --gpus all ”:
    GitHub - NVIDIA/nvidia-docker: Build and run Docker containers leveraging NVIDIA GPUs

  2. What is the benefit of using nvidia-container-toolkit instead of using my own way? And what is the difference?

  3. In my Xavier, none of the nvidia-docker2 or nvidia-container-toolkit is installed. I think this is because I flashed my Xavier by “” script instead of sdk manager. So I want to manually install nvidia-container-toolkit following the steps in GitHub - NVIDIA/nvidia-docker: Build and run Docker containers leveraging NVIDIA GPUs. But it got an error in apt update:
    E: The repository ‘ Release’ does not have a Release file.
    It seems the repos for nvidia-container-toolkit doesn’t support ARM/ARM64.
    So how can I install nvidia-container-toolkit?

  4. Under sdk manager download directory, it has many .deb files for nvidia container:
    Can I install nvidia-container-toolkit by install its .deb package + its dependencies?


1. Currently, please use docker with nvidia runtime.

$ sudo docker run --runtime nvidia ...

2. Our container has CUDA toolkit preinstalled.
It’s looks like your only has Ubunut based.

3. No. The package is part of SDK component. It should be installed by default.You can check it with this:

$ sudo dpkg --get-selections | grep nvidia
libnvidia-container-tools			install
libnvidia-container0:arm64			install
nvidia-container-runtime			install
nvidia-container-runtime-hook	        	install
nvidia-docker2				        install
$ sudo docker info | grep nvidia
+ Runtimes: nvidia runc

4. It’s recommended use sdkmananger to install it for you.
It handles all the dependencies.