MoTTY X11 proxy: No authorisation provided
qt.qpa.xcb: could not connect to display localhost:10.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.
原因:在 Docker 容器里运行 RViz2(Qt 程序),但是容器里没有图形显示环境,导致 xcb 插件连不上宿主机的 X server
因为是是远程 SSH 登录,可以看到的 localhost:10.0 就是 SSH 的 X11 转发,不适合 Docker
解决方法:
1.禁用 SSH 的 X11 转发,改用宿主机的 X11
export DISPLAY=:0
继续用 X11 转发,但让容器也走 SSH 的 DISPLAY
docker run -it \
--net=host \
--env="DISPLAY=$DISPLAY" \
--env="QT_X11_NO_MITSHM=1" \
--volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
--volume="$HOME/.Xauthority:/root/.Xauthority:rw" \
fishros2/ros:foxy-desktop

1146

被折叠的 条评论
为什么被折叠?



