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

搞定

相关推荐
山上三树1 小时前
Qt QObject介绍
开发语言·qt
山上三树1 小时前
QObject、QWidget、Widget三者的关系
qt
坚定学代码1 小时前
qt c++ 局域网聊天小工具
c++·qt·个人开发
笨笨马甲2 小时前
Qt network开发
开发语言·qt
mengzhi啊19 小时前
Qt Designer UI 界面 拖的两个 QLineEdit,想按 Tab 从第一个跳到第二个
qt
笨笨马甲1 天前
Qt MQTT
开发语言·qt
姓刘的哦1 天前
Qt实现蚂蚁线
开发语言·qt
Ivy_belief1 天前
Qt网络编程实战:从零掌握 QUdpSocket 及 UDP 通信
网络·qt·udp
丁劲犇1 天前
在Trae Solo模式下用Qt HttpServer和Concurrent升级MCP服务器绘制6G互联网覆盖区域
服务器·开发语言·qt·ai·6g·mcp·trae
笨笨马甲1 天前
Qt MODBUS协议
开发语言·qt