Download image from Docker Hub
$ docker pull kakalin/qt:5.12.0
# Expose the X server on the host
$ xhost +local:docker
$ docker run --rm -it \
-e DISPLAY=$DISPLAY \
-e QT_X11_NO_MITSHM=1 \
--volume="/tmp/.X11-unix:/tmp/.X11-unix" \
--volume="$PWD:/home/user/qt-video-player" \
--device /dev/snd \
-e PULSE_SERVER=unix:${XDG_RUNTIME_DIR}/pulse/native \
-v ${XDG_RUNTIME_DIR}/pulse/native:${XDG_RUNTIME_DIR}/pulse/native \
--privileged \
kakalin/qt:5.12.0
- GPU: Please refer to nvidia-docker
Reference: X11 in docker on macOS
-
Install XQuartz from official website or through Homebrew
$ brew install --cask xquartz
and then
Restart OS
. -
Open XQuartz and Check the option:
XQuartz -> Preferences -> Security -> "Allow connections from network clients"
# open XQuartz $ open -a XQuartz
-
In terminal:
# Expose the X server on the host $ xhost +localhost
$ docker run --rm -it \ -e DISPLAY=host.docker.internal:0 \ -e QT_X11_NO_MITSHM=1 \ --volume="/tmp:/tmp" \ --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \ --volume="$PWD:/home/user/qt-video-player" \ --device /dev/dri \ --device /dev/snd \ --privileged \ kakalin/qt:5.12.0
-
Qt is not found
Opening
CMakeLists.txt
and uncommentlist(APPEND CMAKE_PREFIX_PATH ${Your Qt path})
and modify Qt location -
libGL error: No matching fbConfigs or visuals found
$ export LIBGL_ALWAYS_INDIRECT=1
-
QGLXContext: Failed to create dummy context
Workaround:
$ export QT_QUICK_BACKEND=software