Docker: QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
# Issue
GUI cannot be started when I run RVIZ and other GUI programs
```sh
root@yubao-desktop:~/catkin_ws/src# rosrun rviz rviz
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
[ INFO] [1592546827.600791426]: rviz version 1.13.12
[ INFO] [1592546827.600826376]: compiled against Qt version 5.9.5
[ INFO] [1592546827.600831631]: compiled against OGRE version 1.9.0 (Ghadamon)
[ INFO] [1592546827.605823998]: Forcing OpenGl version 0.
dbus[285]: 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
Aborted (core dumped)
```
# Solution
Add this to docker-compose.yaml
```sh
privileged: true
```
# Full example
- Docker compose
```sh
version: '2.3'
services:
ubuntu18_cuda10.2_ros:
image: yubaoliu/root:ros-cuda10.2-cudnn7-ubuntu18.04
build:
context: .
dockerfile: Dockerfile
args:
cuda_version: 10.2
nvidia_cudnn_version: 7.6.5.32-1+cuda10.2
# cudnn_version: 7
ubuntu_version: 18.04
runtime: nvidia
command:
- roscore
stdin_open: true
privileged: true
tty: true
network_mode: "host"
environment:
- DISPLAY
- QT_X11_NO_MITSHM=1
volumes:
- /tmp/.X11-unix:/tmp/.X11-unix:rw
```
- Start docker
```sh
docker-compose -f cuda10.2.yaml up --force-recreate --remove-orphans
```
- Start docker terminal
```sh
docker-compose -f cuda10.2.yaml exec ubuntu18_cuda10.2_ros bash
```
- Start RVIZ
No comments