Reputation: 13
I am trying to run a Qt5 application (utilizing QML and a cpp main) in a docker (FROM ubuntu:20.04) running on a native Ubuntu (20.04) host. The application fails with:
#: ./src/qt_files/qt_gui
QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
libGL error: No matching fbConfigs or visuals found
libGL error: failed to load driver: swrast
QGLXContext: Failed to create dummy context
Failed to create OpenGL context for format QSurfaceFormat(version 2.0, options QFlags<QSurfaceFormat::FormatOption>(), depthBufferSize 24, redBufferSize -1, greenBufferSize -1, blueBufferSize -1, alphaBufferSize -1, stencilBufferSize 8, samples -1, swapBehavior QSurfaceFormat::DoubleBuffer, swapInterval 1, colorSpace QSurfaceFormat::DefaultColorSpace, profile QSurfaceFormat::NoProfile)
Aborted (core dumped)
I am able to run the application natively without issue, but have failed to get it running in docker.
The docker run command I use is:
docker run -it --rm --privileged -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v $HOME:/myhome -v /dev/:/dev/ --name qt-dev myqtdocker /bin/bash
I also utilize xhost local:root
and have confirmed that I can run other x11 apps from the docker.
Comparing ldd outputs seem to show that the application links against the same libs both in docker and natively.
It should be noted that yes, the machine contains a dedicated NVIDIA GPU but I am intentionally not using it as the runtime in either environment. (As confirmed with nvidia-smi). Though I could be wrong about how the drivers are being loaded and I am welcome to any suggestion. Thank you in advanced for your help.
Upvotes: 1
Views: 2247
Reputation: 36
A workaround is to add -e QT_QUICK_BACKEND=software
to your run command or ENV QT_QUICK_BACKEND=software
to your docker file.
I am still looking for a way to run it using hardware mode since there are some issues with map polyline in software mode.
Upvotes: 2