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

搞定

相关推荐
慧都产品智能化8 小时前
Qt 表格升级攻略:复用已有编辑器,减少重复开发
c++·qt·编辑器·qt6.3
ShineWinsu8 小时前
对于Qt:QTableWidget常见属性以及QTableWidgetItem类的解析
开发语言·c++·qt·gui·客户端·表格·qtablewidget
ShineWinsu9 小时前
对于Qt:QListWidget常见属性以及QListWidgetItem类的解析
开发语言·c++·qt·客户端·列表·qlistwidget·qlistwidgetitem
ShineWinsu15 小时前
对于Qt:QDial常见属性以及信号的解析
开发语言·c++·qt·gui·客户端·旋钮·qdial
宛 禾1 天前
Qt 事件系统完全指南:从事件循环到实战避坑
qt
敲上瘾1 天前
Qt Widgets入门:项目模板解析与Hello World
开发语言·数据库·c++·qt·ui·qt6.3
MOONICK2 天前
QT元数据
开发语言·qt
橙橙笔记2 天前
QT的学习第四部分
linux·qt·学习·音视频
sycmancia3 天前
Qml——信号连接、自定义信号
qt
奇树谦5 天前
Qt Quick 图片加载与 GPU 纹理机制详解:QImage、QQuickTextureFactory、QSGTexture 与异步加载
开发语言·qt·系统架构