Build a docker for PySide6
Unsolved
Installation and Deployment
-
have a python application that makes use of PySide6. I am able to run this locally.
Now, I am moving this to docker so that all other contributors need not install packages and libraries required individually.
Here is my "Dockerfile":
# Use an official Python runtime as a parent image FROM python:3.11 # Set the working directory in the container to /app WORKDIR /app # Copy the current directory contents into the container at /app COPY . /app # Note: Adding libxcb-cursor0, libegl1, and other dependencies for PySide6 and the XCB platform plugin # Install necessary system dependencies for running a PySide6 application RUN apt-get update && apt-get install -y \ libgl1-mesa-glx \ libxkbcommon-x11-0 \ libxcb-icccm4 \ libxcb-image0 \ libxcb-keysyms1 \ libxcb-randr0 \ libxcb-render-util0 \ libxcb-render0 \ libxcb-shape0 \ libxcb-sync1 \ libxcb-xfixes0 \ libxcb-xinerama0 \ libxcb-xkb1 \ libxcb1 \ libxrender1 \ libxi6 \ libdbus-1-3 \ libxcb-cursor0 \ libegl1 \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* # Install PySide6 without specifying a version to get the latest RUN pip install --upgrade pip && \ pip install PySide6 # Define environment variable ENV NAME MockTOEFL # Command to run the application CMD ["python", "Reading/temp.py"]
Here is the command I am using to build and run the docker:
docker run my_application
I am facing the below error during run:
qt.qpa.plugin: From 6.5.0, xcb-cursor0 or libxcb-cursor0 is needed to load the Qt xcb platform plugin. 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: linuxfb, vkkhrdisplay, wayland, minimalegl, xcb, minimal, offscreen
-
Hi and welcome to devnet,
From memory, you need to also set the DISPLAY environment variable and mount the X11 socket in the container. I think there was also something with Xauthority.