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

搞定

相关推荐
数巨小码人3 小时前
QT SQL框架及QSqlDatabase类
jvm·sql·qt
程序员老舅5 小时前
C++ Qt项目教程:WebServer网络测试工具
c++·qt·测试工具·webserver·qt项目·qt项目实战
enyp806 小时前
Qt QStackedWidget 总结
开发语言·qt
luoyayun3616 小时前
Trae+Qt+MSVC环境配置
vscode·qt·环境配置·trae qt
水瓶丫头站住14 小时前
Qt中QDockWidget的使用方式
开发语言·qt
laimaxgg15 小时前
Qt常用控件之数字显示控件QLCDNumber
开发语言·c++·qt·qt5·qt6.3
牵牛老人16 小时前
Qt开发中出现中文乱码问题深度解析与解决方案
开发语言·qt
Zfox_16 小时前
【QT】信号与槽 & 窗口坐标
开发语言·c++·qt·qt5
进击ing小白19 小时前
Qt程序退出相关资源释放问题
开发语言·qt
OrangeJiuce20 小时前
【QT中的一些高级数据结构,持续更新中...】
数据结构·c++·qt