Hi there, we got RViz to work through nvidia-docker2 (with OpenGL) by following the guide here:
http://wiki.ros.org/action/login/dock...
We had to modify the script a bit to make it work:
# If not working, first do: sudo rm -rf /tmp/.docker.xauth
# It still not working, try running the script as root.
XAUTH=/tmp/.docker.xauth
echo "Preparing Xauthority data..."
xauth_list=$(xauth nlist :0 | tail -n 1 | sed -e 's/^..../ffff/')
if [ ! -f $XAUTH ]; then
if [ ! -z "$xauth_list" ]; then
echo $xauth_list | xauth -f $XAUTH nmerge -
else
touch $XAUTH
fi
chmod a+r $XAUTH
fi
echo "Done."
echo ""
echo "Verifying file contents:"
file $XAUTH
echo "--> It should say \"X11 Xauthority data\"."
echo ""
echo "Permissions:"
ls -FAlh $XAUTH
echo ""
echo "Running docker..."
docker run -it \
--env="DISPLAY=$DISPLAY" \
--env="QT_X11_NO_MITSHM=1" \
--volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
--env="XAUTHORITY=$XAUTH" \
--volume="$XAUTH:$XAUTH" \
--net=host \
--privileged \
--runtime=nvidia \
our-nvidia-based-ros-melodic-image-plus-nvidia-env-vars-from-the-guide:latest \
bash
echo "Done."
Note 1: We added the tail -n 1
into the xauth
sequence since the original command resulted in two identical lines after the sed
replacement. So we only took one of them.
Note 2: The --net=host
and --privileged
are only needed if you want to join the host pc network. We added it to test communication with RViz by playing a bag-file from the outside using rosbag play
and seeing the images being received by RViz.
Could you please use only a single sentence or question as title? (like the rest of the questions?) It does not make much sense to just paste the same text in both fields..
Please see if the information on the wiki/docker pages sheds some light on things.