Ask Your Question

How to view Gazebo and RViz GUIs through Docker whilst sharing connection?

asked 2020-11-16 02:37:56 -0600

Py gravatar image

I have a Docker container running a robot simulation through Gazebo with data visualised through RViz. This seems to work great until I use the --net=host option to make its topics available to subscribe and publish to from another ROS system running on the host. The error message I get on the container is as follows (similar for Gazebo):

process[rviz-9]: started with pid [261]
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
dbus[261]: 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
[rviz-9] process has died [pid 261, exit code -6, cmd /opt/ros/melodic/lib/rviz/rviz -d /workspace/src/simulation/config/rviz_config.rviz __name:=rviz __log:=/root/.ros/log/4a62825e-27e5-11eb-bb41-50eb712545a4/rviz-9.log].
log file: /root/.ros/log/4a62825e-27e5-11eb-bb41-50eb712545a4/rviz-9*.log

Here's the script I used to run the container:


xhost +local:root

if [ ! -f $XAUTH ]
    xauth_list=$(xauth nlist :0 | sed -e 's/^..../ffff/')
    if [ ! -z "$xauth_list" ]
        echo $xauth_list | xauth -f $XAUTH nmerge -
        touch $XAUTH
    chmod a+r $XAUTH

docker run -it \
    --rm \
    --net=host \
    --env="DISPLAY=$DISPLAY" \
    --env="QT_X11_NO_MITSHM=1" \
    --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
    --env="XAUTHORITY=$XAUTH" \
    --volume="$XAUTH:$XAUTH" \
    --runtime=nvidia \
    simulation:latest \
    roslaunch simulation simulation.launch
export containerId=$(docker ps -l -q)

xhost -local:root

Any ideas what I might have done wrong?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2020-11-16 07:07:20 -0600

Py gravatar image

I solved this by adding --privileged before --net=host.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2020-11-16 02:37:56 -0600

Seen: 423 times

Last updated: Nov 16 '20