Hi,
I'm trying to use Rviz2 from within a Docker container.
I'm working on top of this Docker image
FROM osrf/ros2:bouncy-desktop
This is my run script
#!/bin/bash
XSOCK=/tmp/.X11-unix
XAUTH=/tmp/.docker.xauth
touch $XAUTH
xauth nlist $DISPLAY | sed -e 's/^..../ffff/' | xauth -f $XAUTH nmerge -
docker run -it --rm \
-e XAUTHORITY=${XAUTH} \
-e DISPLAY=$DISPLAY \
-e QT_GRAPHICSSYSTEM=native \
-v $XSOCK:$XSOCK:rw \
-v $XAUTH:$XAUTH:rw \
ros2_docker \
bash
Everything works fine, but then I needed to make the Docker container communicate with other machines on the host network.
I accomplished that by adding the following option to docker run
--net=host \
This solves the connectivity issue, but has the side effect of making rviz not working anymore. If I try to run rviz, I only get the following error.
ros2 run rviz2 rviz2
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
dbus[1041]: The last reference on a connection was dropped without closing the connection. This is a bug in an application. See dbus_connection_unref() documentation for details.
Most likely, the application was supposed to call dbus_connection_close(), since this is a private connection.
D-Bus not built with -rdynamic so unable to print a backtrace
Any idea about how to fix this? Thanks
Originally posted by alsora on ROS Answers with karma: 1322 on 2018-08-20
Post score: 4
Original comments
Comment by ruffsl on 2018-08-20:
That's peculiar. I'm using nvidia docker, yet I can reproduce your rviz(1 or 2) XDG_RUNTIME_DIR
error when adding --net=host
for both melodic and bouncy images.
Comment by ruffsl on 2018-08-20:
XDG_RUNTIME_DIR
doesn't seem to be necessary the issue, given it otherwise would normally default to something like '/tmp/runtime-root'
. The privilege issue with managing the dbus connection seem to be the setback here.