-
Notifications
You must be signed in to change notification settings - Fork 2k
Can't set up a Xorg server in secondary graphics card #136
Comments
We don't support this use case. I'm curious though why don't you leverage the X server from your host instead? |
The ROS community does something similar by leverage the X server from your host. |
Thanks for the answers. @3XX0 I was actually trying to compare the (supposed) performance gain of having the X server directly in the container talking to the graphics card instead of the host. I understand you don't support this use case, but AFAIK it is doable, right? I eventually managed to start the X server in the container by manually copying the necessary files - namely, the nvidia_drv.so that was missing. However it broke the host's X server in the first card, I think it has to do with the management of tty or something (I'm actually clueless about this). @ruffsl thanks for the links. As I mention in the previous paragraph, my intention was to compare that method you reference (following this tutorial) and the x-server-direct-from-the-container approach. However, the method you mention doesn't allow me to run more graphic-hungry apps, like glxgears:
Apps like |
This Dockerfile and launch process works for me: FROM ubuntu:16.04
# install GLX-Gears
RUN apt-get update && apt-get install -y \
mesa-utils && \
rm -rf /var/lib/apt/lists/*
# nvidia-docker hooks
LABEL com.nvidia.volumes.needed="nvidia_driver"
ENV PATH /usr/local/nvidia/bin:${PATH}
ENV LD_LIBRARY_PATH /usr/local/nvidia/lib:/usr/local/nvidia/lib64:${LD_LIBRARY_PATH} docker build -t foo .
xhost +local:root
nvidia-docker run -it \
--env="DISPLAY" \
--volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
foo glxgears
xhost -local:root We use this same method to run RVIZ and gazebo from containers, rendering dense point clouds, raytracing for visual sensors, and displaying robot 3D models. Here's an old example from a little more that a year ago: https://www.youtube.com/watch?v=djLKmDMsdxM . Note, I was getting the same performance from running the stack locally on the host. I'm not sure how much you'd gain from not needing to use the unix socket, but I guess your search might be helpful when we all migrate away from Xserver and onto Mir or what not, but would still like to use legacy X apps. |
Your problem is probably due to conflicting libGL, as @flx42 mentioned try the Also it's using direct rendering so you shouldn't see any performance impact. |
Thanks a lot guys. Using both @ruffsl 's Dockerfile and the code in the And exactly as @3XX0 has mentioned, glmark2 scores essentially the same when run from the host and from the container. Given the circumstances, there's no need to keep digging into running the X server from the container. However as I briefly commented here, it's definitely possible, once you sort out the coexistence of the host's X server and the container's. I think that would mean trying to assign a different tty to the container's host, at least as a first step. There doesn't seem to be too much info about this. |
Just as an update for folks, here is a minimal working example for GLX-Gears GUI using nvidia-docker2. FROM ubuntu:18.04
# install GLX-Gears and the GL Vendor-Neutral Dispatch library
RUN apt-get update && apt-get install -y \
libglvnd0 \
mesa-utils && \
rm -rf /var/lib/apt/lists/*
# nvidia-container-runtime
ENV NVIDIA_VISIBLE_DEVICES \
${NVIDIA_VISIBLE_DEVICES:-all}
ENV NVIDIA_DRIVER_CAPABILITIES \
${NVIDIA_DRIVER_CAPABILITIES:+$NVIDIA_DRIVER_CAPABILITIES,}graphics docker build -t foo .
xhost +local:root
nvidia-docker run -it \
--env="DISPLAY" \
--volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
foo glxgears
xhost -local:root |
FYI, we have samples here
|
https://gitlab.com/mash-graz/resolve is another example how to run a quite demanding real world application (DaVinci Resolve) utilizing OpenGL in nvidia-docker2 |
thx for the example @ruffsl i'm trying to get this working on the TX2 and i have built libglvnd from source since there are no 16.04 arm64 packages it seems
however i get: BadValue (integer parameter out of range for operation)
any suggestions? |
@nathantsoi If the problem still occours, be sure that the gid of the group video is the same between the host and the container. -l |
@nathantsoi Did you get it working in the end? I have the same error. Even when following the nvidia/opengl glxgears sample. @nathantsoi gid of video is 44 on both host and container. As per the example, I run I have an optimus laptop. However I do Furthermore, the example by ruffsl in issue #136 works, but runs glxgears on my Intel card, rather than Nvidia. Driver version 390.87, Cuda 9.0 on both host & container. Thanks for any suggestion! |
I haven't had time to debug again. I ended up copying all the dependencies to a folder and running outside of docker (after building w/in docker) by setting LD_LIBRARY_PATH to the folder. Hope that helps! |
I'm working with a server with dual Quadro K2200 graphics card. The host is RHEL 7.2, I've installed Docker 0.11 and nvidia-docker. The output for nvidia-smi is this:
Now I'm trying to build a container (currently I don't care about the distro, I'm trying with both centos and debian) that uses the second card to show an X server, but so far I haven't had any luck. This is the Dockerfile I'm working with:
After building the image I start a container with
And there I run
Xorg -configure
to create a scaffolding for the conf file, that I tweak to use thenvidia
driver and just the second car (by removing all references to the first card). If I try to start the X server withxinit
, I get the following at the end of the log:I've tried installing the NVIDIA driver from within the container, but it fails as it already detects nvidia-related modules running, as the output of lsmod shows:
Any clue? Thanks!
The text was updated successfully, but these errors were encountered: