I am trying to dockerize my PyQt6 application and I do have some problems with it.
My application works fine outside the docker. I wrote my Dockerfile
:
FROM ubuntu:latest
RUN apt-get update && apt-get install -y \
python3.10 \
python3-pip \
libgl1-mesa-glx \
libegl1-mesa \
libqt6core6 \
libqt6gui6 \
libqt6widgets6 \
&& rm -rf /var/lib/apt/lists/*
ENV POETRY_PYTHON=python3.10
COPY pyproject.toml poetry.lock /draughts/
RUN pip install poetry
RUN cd /draughts && \
poetry config virtualenvs.in-project true && \
PYTHON_KEYRING_BACKEND=keyring.backends.fail.Keyring poetry install --without=dev
COPY . /draughts
To run the image I use this command: sudo docker run -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY draughts
So after connecting to the container I cd to my applicatoin and run poetry run python src/draughts/main.py
The output from this command is:
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" 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, vkkhrdisplay, offscreen, eglfs, vnc, wayland-egl, wayland, minimalegl, linuxfb, minimal.
Aborted (core dumped)
Am I missing some steps or packages here?