Source Repository: https://github.com/kaka-lin/qt-template/tree/master/docker
635
# $ docker build --rm -t kakalin/qt:5.12.0 .
$ ./build.sh
$ docker login
# $ docker push kakalin/qt:5.12.0
$ ./deploy.sh
Ubuntu# Expose the X server on the host
$ xhost +local:docker
Notice current path, if you use `$PWD`,
you should in the root path of the project,
GPU
$ docker run --rm -it \
--gpus all \
-e DISPLAY=$DISPLAY \
-e QT_X11_NO_MITSHM=1 \
--volume="/tmp/.X11-unix:/tmp/.X11-unix" \
--volume="$PWD:/home/user/qt-template" \
--privileged \
kakalin/qt:5.12.0
CPU
$ 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-template" \
--privileged \
kakalin/qt:5.12.0
macOSReference: 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
Creating a bridge between a network socket with a TCP listener on port 6000 (the default port of the X window system) and the X window server on my OS X host.
$ socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\"
$ docker run --rm -it \
-e DISPLAY=host.docker.internal:0 \
-e QT_X11_NO_MITSHM=1 \
-e QT_QUICK_BACKEND=software \
--volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" \
--volume="$PWD:/home/user/qt-template" \
kakalin/qt:5.12.0
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
Miniconda install issue:
Install Python3.8, ModuleNotFoundError: No module named 'conda.cli.main_info'
comment `conda update -n base conda`
2022/12/6 update: If the old command has error, we can replace it as below:
# Install miniconda for python 3.8
ENV PYTHON_VERSION="3.8"
ENV CONDA_PATH="/usr/local/anaconda3"
ENV MINICONDA_FILE="Miniconda3-py38_4.12.0-Linux-x86_64.sh"
RUN wget https://repo.continuum.io/miniconda/${MINICONDA_FILE} && \
sh ${MINICONDA_FILE} -b -p ${CONDA_PATH} && \
${CONDA_PATH}/bin/conda update -n base conda && \
${CONDA_PATH}/bin/conda install python=${PYTHON_VERSION} && \
${CONDA_PATH}/bin/conda clean -y -a && \
rm -rf ${MINICONDA_FILE} && \
rm -rf /temp/*
Content type
Image
Digest
sha256:0221af2da…
Size
3.5 GB
Last updated
about 2 years ago
docker pull kakalin/qt:5.15.10_opencv_gstreamer