Hello.
I used rtx 3060ti and i have problem with docker and python3 opencv. Also i want ask about how used opencv with docker with nvidia support with python3.
But first off all:
I try to make Dockerfile with python3 opencv. Right now it looks like:
FROM ubuntu:latest
RUN apt-get update && apt-get install -y \
python3 \
python3-pip \
python3-opencv \
ffmpeg \
libgl1 \
libsm6 \
libxext6 \
libgl1-mesa-dev \
libglib2.0-0
ENV DEBIAN_FRONTEND=noninteractive
ENV PIP_BREAK_SYSTEM_PACKAGES 1
ENV QT_QPA_PLATFORM=xcb
ENV DISPLAY=:1
RUN pip install pyyaml mediapipe opencv-python opencv-contrib-python opencv-python-headless
COPY . /app
WORKDIR /app
COPY main.py /app
CMD ["python3", "main.py"]
But when i run container, container suddenly down with message like:
docker run --device=/dev/video0 --privileged --rm test_opencv:latest
qt.qpa.xcb: could not connect to display :1
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/usr/local/lib/python3.12/dist-packages/cv2/qt/plugins" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: xcb.
Any idea how to repair it?