2025-02-25 00:46阅读: 18评论: 0推荐: 0

解决Docker连接XQuartz报错

背景

打开XQuartz,在桌面右上角菜单栏中的XQuartz偏好设置中的安全性中启用 "允许从网络客户端连接",并重启XQuartz生效,后续操作中要保持XQuartz为打开状态,不要退出XQuartz

报错内容:

root@9b90039a4d17:~# ros2 run turtlesim turtlesim_node
Authorization required, but no authorization protocol specified
qt.qpa.xcb: could not connect to display host.docker.internal: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.

配置权限

如果 XQuartz 仍然无法接受来自 Docker 容器的连接,尝试在宿主机上运行以下命令:

xhost + 127.0.0.1

这样可以允许来自本地地址(127.0.0.1)的连接。

解决实例

本文作者:孤飞

本文链接:https://www.cnblogs.com/ranxi169/p/18735257

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   孤飞  阅读(18)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
点击右上角即可分享
微信分享提示
💬
评论
📌
收藏
💗
关注
👍
推荐
🚀
回顶
收起