Run rviz in a docker with hardware acceleration (no gui)
We would like to run rviz in a docker without a screen or gui. Reason for this is that we have camera's in rviz outputting on an image topic. We can visualize this outside of the docker on another computer.
So running rviz in a docker can be done:
FROM ros:noetic
RUN sudo apt-get update && sudo apt-get install -qqy xvfb ros-noetic-rviz
ENV DISPLAY :99
CMD /bin/bash -c "xvfb-run rviz"
This does not use the GPU however, and is therefor 10x slower than running rviz with a screen attached.
Is there a way to still use the GPU?
For Nvidia GPUs it’s possible: https://github.com/NVIDIA/nvidia-docker. I am not sure about others.
This is not the most updated info but can help for other type of GPUs: http://wiki.ros.org/docker/Tutorials/...
Thanks for thinking along. We have an Intel graphics card. I already discovered the wiki you linked, but that one assumes you want to display rviz (and actually have a display).
If you search for
xvfb hardware acceleration
(using Google), it's clearxvfb
does not support it. It was expressly created to avoid needing actual hw to run an X server (and apparently that also means it can't actually use any hw, even if it's available).I've not done it myself for this use-case specifically, but perhaps looking into setting up a VNC server with hw-accelerated OpenGL could provide some ideas. VirtualGL comes to mind, as well as xpra.
Edit: it could be
xpra
actually supports this. See usage/OpenGL.xpra works! If you can enter that as an answer, I can mark it as solution.
I'd suggest to post an answer detailing what you did exactly. That would be infinitely more valuable than a single-line answer by me suggesting "maybe xpra can do this".