GUI Qt Application in a docker container


GUI Qt Application in a docker container

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.
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.
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.
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



Solution 1:

Qt5 and Qt4 has a different rendering subsystems

Qt4 renderer just needs a hint:

export QT_GRAPHICSSYSTEM="native"

This must be work

QT_GRAPHICSSYSTEM="native" docker run -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix someQt4AppContainer