dockernvidiansightnvidia-docker

How can I create a container in which to use the Nvidia Nsight Systems graphical interface?


I am looking to create a container in which I can work with the graphical interface of the Nvidia Nsight Systems tool, to be able to obtain application reports with cuda and python, I have found several guides that say that this is possible and in particular I have followed the one I leave continuation:

https://leimao.github.io/blog/Docker-Nsight-Systems/

I haven't had many problems until I got to the point of launching the graphical interface itself once the container was created, where I saw the following error:

################# ERROR: CrashReporter #################
CrashReporter

Qt initialization failed

Failed to load Qt platform plugin: "xcb"
Library path: /opt/nvidia/nsight-systems/2023.4.1/host-linux-x64/Plugins/platforms/ http://libqxcb.so
Application is going to abort
sh: 1: xmessage: not found
/usr/local/bin/nsys-ui: line 63: 38 Aborted (core dumped) "$NV_AGORA_PATH/CrashReporter" --hide-stack "NVIDIA Nsight Systems" "NsightSystems" "2023.4.1 (Build 2023.4.1.97-234133557503v0)" "$NV_QUADD_PATH" "$@"
""

After searching for this error, several solutions appear, such as installing additional libraries such as libxcb-xinerama0 or libxcb-cursor0, so I have added them to the dockerfile, but the error persists, does anyone know how to solve it or another way to create docker that worked.

This is the Dockerfile I am using:

FROM nvcr.io/nvidia/cuda:12.0.1-devel-ubuntu22.04

ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update -y && \
    apt-get install -y --no-install-recommends \
        apt-transport-https \
        ca-certificates \
        dbus \
        fontconfig \
        gnupg \
        libasound2 \
        libfreetype6 \
        libglib2.0-0 \
        libnss3 \
        libsqlite3-0 \
        libx11-xcb1 \
        libxcb-glx0 \
        libxcb-xkb1 \
        libxcomposite1 \
        libxcursor1 \
        libxcb-xinerama0 \
        libxdamage1 \
        libxi6 \
        libxml2 \
        libxrandr2 \
        libxrender1 \
        libxtst6 \
        libgl1-mesa-glx \
        libxkbfile-dev \
        openssh-client \
        libxcb-cursor0\
        wget \
        xcb \
        xkb-data && \
    apt-get clean

RUN cd /tmp && \
    wget https://developer.nvidia.com/downloads/assets/tools/secure/nsight-systems/2023_4_1_97/nsight-systems-2023.4.1_2023.4.1.97-1_amd64.deb && \
    apt-get install -y ./nsight-systems-2023.4.1_2023.4.1.97-1_amd64.deb && \
    rm -rf /tmp/*

# CMD ["nsys-ui"]

And this the intructions to build:

docker build -f nsight-systems.Dockerfile --no-cache --tag=nsight-systems:2023.4 .

to run:

docker run -it --rm --gpus all -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --cap-add=SYS_ADMIN --security-opt seccomp=unconfined -v $(pwd):/mnt --network=host nsight-systems:2023.4

and to execute the program in the docker:

nsys-ui

Solution

  • First of all, thank you very much for taking the time to respond.

    I solve it by running docker in the following way:

    docker run -it --rm --gpus all --net=host -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --cap-add=SYS_ADMIN --security-opt seccomp=unconfined -v $(pwd):/mnt --privileged -v "$HOME/.Xauthority:/root/.Xauthority:rw" nsight-systems:2023.4
    

    I leave here the link where I have seen the solution for the credit, thank you very much and an incredible job:

    X11 forwarding of a GUI app running in docker