最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Running Qt application in Docker container and application needs dbus connection with host - Stack Overflow

programmeradmin2浏览0评论

I built a qt app that I can run in a docker container on an ubuntu host that uses wayland.

In my docker run, I had add these options:

-e QT_QPA_PLATFORM_PLUGIN_PATH=/usr/lib/x86_64-linux-gnu/qt6/plugins/platforms 
-e QT_QPA_PLATFORM=wayland
-e GDK_BACKEND=wayland
-e SDL_VIDEODRIVER=wayland
-e XDG_SESSION_TYPE=wayland
-e XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR
-e WAYLAND_DISPLAY=$WAYLAND_DISPLAY
-v $XDG_RUNTIME_DIR/$WAYLAND_DISPLAY:$XDG_RUNTIME_DIR/$WAYLAND_DISPLAY

So this allows me to launch my qt app in the container and the GUI appears on the host machine. Great. But now I need to connect to the system dbus.

The docker container needs to be run with --privileged=true in order for the app in the container to connect to the system dbus service, and that works. Without --privileged=true, I will get this error:

err[88]: Socket operation on non-socket

But with --privileged=true the wayland part no longer works. I get this error:

Failed to create wl_display (Connection refused)
qt.qpa.plugin: Could not load the Qt platform plugin "wayland" in "/usr/lib/x86_64-linux-gnu/qt6/plugins/platforms" 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: offscreen, vnc, vkkhrdisplay, minimalegl, xcb, wayland-egl, wayland, linuxfb, minimal, eglfs.

So I need to run wayland app in docker that needs dbus connection to host . The wayland app cannot be run with --privileged=true The dbus requires it.

How can I run app in docker and let it access system dbus without --privileged=true option

发布评论

评论列表(0)

  1. 暂无评论