问题描述
我尝试在具有/tmp/.X11-unix挂载的容器docker中运行一些Qt应用程序。我在看到了这一点,这很困难。
I try to run some Qt application in a container docker with a mount of /tmp/.X11-unix. I saw here that can be difficult.
因此,当我在容器docker中运行kdevelop时,它不起作用(我有一个空窗口)。但是,如果我运行qtcreator,就可以了。
So when I run kdevelop in container docker, it does not work ( I have an empty window ). But if I run qtcreator it's fine.
我认为区别在于Qt版本(kdevelop在Qt4中开发,而qtcreator在Qt5中开发)。我所有其他的qt5应用程序都可以正常运行,但在qt4中却没有一个。
I think the difference comes from the Qt version (kdevelop are developped in Qt4 and qtcreator in Qt5). All my others qt5 applications works fine, but not a single in qt4.
问题:
有人知道吗?在不通过vnc或ssh的情况下如何启动qt4应用程序,就像这样:
Does anyone know what to do to launch an qt4 application without going through vnc or ssh, just like this:
docker run -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix someQt4AppContainer
?
推荐答案
Qt5和Qt4具有不同的渲染子系统
Qt5 and Qt4 has a different rendering subsystems
Qt4渲染器只需要一个提示:
Qt4 renderer just needs a hint:
export QT_GRAPHICSSYSTEM="native"
必须工作
QT_GRAPHICSSYSTEM="native" docker run -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix someQt4AppContainer
这篇关于Docker容器中的GUI Qt应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!