Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Start pyqt5 app automatically on start-up in docker



  • I am running an pyqt5 app inside docker normally with commands

    xhost +si:localuser:root
    docker run -it -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -v /etc/localtime:/etc/localtime:ro loggingface_ui
    

    However, when i need add it to auto-start on system start-up or even from remote ssh, i am unable to start it and get the logs:

    qt.qpa.screen: QXcbConnection: Could not connect to display localhost:10.0
    Could not connect to any X display.

    How do i solve this issue?


  • Lifetime Qt Champion

    @voqtuyen said in Start pyqt5 app automatically on start-up in docker:

    qt.qpa.screen: QXcbConnection: Could not connect to display localhost:10.0

    Looks like there is no X11 running at that time. But I'm not docker expert.



  • localhost:10 is usually the ssh passthrough for x11 forwarding to your local display. I know its insecure but temporarily enable any x11 connection (on the machine you logged in and are running X11 by using xhost + ...I can guarantee your problem is xauth related, but not enough information to tell ou how to fix without turning off all X11 authentication.


Log in to reply