qt.qpa.xcb: could not connect to display 0

问题

docker中启动rviz有问题

$ rviz
qt.qpa.xcb: could not connect to display 0
qt.qpa.plugin: Could not load the Qt platform plugin “xcb” in “” even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.

Aborted (core dumped)

原来是display不对,估计是之前重装nvidia的驱动,使得display搞错了。在host机器上看下display是多少。

echo ${DISPLAY}
:1

在容器中将display设置为:1

export DISPALY:=1
rviz

搞定

你可能感兴趣的:(ROS,qt,rviz,ros)