Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

rViz in nvidia-docker container

I have set up a bunch of ros nodes that each run inside a docker container and are started via docker-compose. I had no problems running it on my laptop, besides rviz being slow since it was running on the cpu only. Now I am moving the project onto a machine that has an nVidia RTX2080 on ubuntu18.04LTS and the same setup produces these errors. I have already installed nvidia-docker2 and the daemon.json is setting the default runtime as nvidia. I don't really know where to start looking at errors. Posts I found were closed without a solution to my problem.

How to get rViz running in nVidia-docker2?

rviz_1           | libGL error: No matching fbConfigs or visuals found
rviz_1           | libGL error: failed to load driver: swrast
rviz_1           | libGL error: No matching fbConfigs or visuals found
rviz_1           | libGL error: failed to load driver: swrast
rviz_1           | libGL error: No matching fbConfigs or visuals found
rviz_1           | libGL error: failed to load driver: swrast
rviz_1           | [ INFO] [1576658065.533954900]: rviz version 1.13.6
rviz_1           | [ INFO] [1576658065.534009692]: compiled against Qt version 5.9.5
rviz_1           | [ INFO] [1576658065.534021481]: compiled against OGRE version 1.9.0 (Ghadamon)
rviz_1           | [ INFO] [1576658065.548489531]: Forcing OpenGl version 0.
rviz_1           | [ WARN] [1576658065.859692866]: OGRE EXCEPTION(3:RenderingAPIException): Unable to create a suitable GLXContext in GLXContext::GLXContext at /build/ogre-1.9-B6QkmW/ogre-1.9-1.9.0+dfsg1/RenderSystems/GL/src/GLX/OgreGLXContext.cpp (line 61)
rviz_1           | rviz::RenderSystem: error creating render window: OGRE EXCEPTION(3:RenderingAPIException): Unable to create a suitable GLXContext in GLXContext::GLXContext at /build/ogre-1.9-B6QkmW/ogre-1.9-1.9.0+dfsg1/RenderSystems/GL/src/GLX/OgreGLXContext.cpp (line 61)
rviz_1           | rviz::RenderSystem: error creating render window: OGRE EXCEPTION(3:RenderingAPIException): Unable to create a suitable GLXContext in GLXContext::GLXContext at /build/ogre-1.9-B6QkmW/ogre-1.9-1.9.0+dfsg1/RenderSystems/GL/src/GLX/OgreGLXContext.cpp (line 61)
like image 315
jaaq Avatar asked Sep 19 '25 11:09

jaaq


1 Answers

See http://wiki.ros.org/docker/Tutorials/Hardware%20Acceleration.
Nvidia docker images need to be built by your own.

$ cd path/to/dir
$ cat Dockerfile
FROM your-repo/your-image:your-tag
# 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 your-nvidia-image .
$ xhost +local:
$ docker run --gpus all -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY your-nvidia-image /bin/bash
like image 187
Obinata Hiroyuki Avatar answered Sep 22 '25 10:09

Obinata Hiroyuki