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

搞定

相关推荐
水煎包V:YEDIYYDS8883 小时前
QT QML 实现的摇杆按钮,类似王者荣耀 左边方向导航键
qt·qml·摇杆按钮·导航键
winfield8214 小时前
MCP 协议详解
开发语言·网络·qt
秦jh_5 小时前
【Qt】常用控件(上)
服务器·数据库·qt
刃神太酷啦5 小时前
C++ list 容器全解析:从构造到模拟实现的深度探索----《Hello C++ Wrold!》(16)--(C/C++)
java·c语言·c++·qt·算法·leetcode·list
水煎包V:YEDIYYDS8886 小时前
QT modbus 通信教程,把modbus封装到线程单例中,在线程内完成数据收发,解析。把重要数据以信号方式通知到qml层展示,解决UI卡顿
qt·modbus·线程服务
东哥很忙XH6 小时前
python使用PyQt5开发桌面端串口通信
开发语言·驱动开发·python·qt
汪宁宇8 小时前
如何在QT5+MinGW环境中编译使用QGIS开发地图应用
c++·qt·qgis·mingw·地图库
刺客xs8 小时前
Qt-----QSS样式表
开发语言·javascript·qt
qq_401700418 小时前
QProgressBar+QSS 进度条
qt
小灰灰搞电子10 小时前
Qt PDF模块详解
数据库·qt·pdf