The story is, I have built a little Python software using Python3.8, PyQt5 and Postgres, so I am trying to create a container in order to dockerize all this stuff, I am thinking to create one Dockerfile to create a container for python + pqt5, another container just for Postgres and then using docker-compose to link everything.
The problem is, when I try to create a container for Python and PyQt5, I am facing this error.
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: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl, xcb.
And this is actually the Dockerfile I am talking about
FROM python:3
COPY *.py /code/
COPY requirements.txt /code/
WORKDIR /code/
RUN apt-get update -y && apt-get upgrade -y && \
apt-get install xvfb -y
RUN pip install --no-cache-dir -r requirements.txt
CMD ["python3", "main.py"]
This is the content of my requirements.txt
psycopg2
requests
PyQt5
I tried all the solutions I found on the web and others on the Docker Hub, but none of them gave me the expected result.
Could any good soul shed light on this problem? Preferably with written code.