Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Run Qt GUI application inside docker.
Forum Updated to NodeBB v4.3 + New Features

Run Qt GUI application inside docker.

Scheduled Pinned Locked Moved Solved General and Desktop
13 Posts 4 Posters 25.1k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D devjb

    I personally did never run a gui application in docker yet. However, I know that you should pass your DISPLAY-Environment variable to docker with -e and as well provide your X11 socket as a shared volume using -v. You will find tutorials around which show how to do so.

    For example (I did not read this article and cannot say whether its content will or will not help) https://medium.com/@SaravSun/running-gui-applications-inside-docker-containers-83d65c0db110

    D Offline
    D Offline
    dariusz.o
    wrote on last edited by dariusz.o
    #3

    @devjb I know this possibility, but it won't work for me. I need to run my X server inside docker, I can't provide X11 socket as volume from host, cuz final host won't have GPU and X at all.
    What I didn't say earlier is that I don't need any preview, this app have to do something with OpenGL in offscreen mode. I just need images that was created by this app. Byt thanks for your reply !

    Pablo J. RoginaP 1 Reply Last reply
    0
    • D dariusz.o

      @devjb I know this possibility, but it won't work for me. I need to run my X server inside docker, I can't provide X11 socket as volume from host, cuz final host won't have GPU and X at all.
      What I didn't say earlier is that I don't need any preview, this app have to do something with OpenGL in offscreen mode. I just need images that was created by this app. Byt thanks for your reply !

      Pablo J. RoginaP Offline
      Pablo J. RoginaP Offline
      Pablo J. Rogina
      wrote on last edited by
      #4

      @dariusz-o said in Run Qt GUI application inside docker.:

      final host won't have GPU

      Just curious how you expect to have an X server running inside the Docker container if the host won't provide a graphical device...

      No devices to configure. Configuration failed.

      Upvote the answer(s) that helped you solve the issue
      Use "Topic Tools" button to mark your post as Solved
      Add screenshots via postimage.org
      Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

      D 1 Reply Last reply
      0
      • Pablo J. RoginaP Pablo J. Rogina

        @dariusz-o said in Run Qt GUI application inside docker.:

        final host won't have GPU

        Just curious how you expect to have an X server running inside the Docker container if the host won't provide a graphical device...

        No devices to configure. Configuration failed.

        D Offline
        D Offline
        dariusz.o
        wrote on last edited by
        #5

        @Pablo-J-Rogina I think that it's possible to tell X server that there is fake monitor connected and for OpenGL usage I can use CPU through MESA drivers. I'm not 100% sure if it possible and if I understand it well. But just for now it seems legit for me.

        Pablo J. RoginaP 1 Reply Last reply
        0
        • D dariusz.o

          @Pablo-J-Rogina I think that it's possible to tell X server that there is fake monitor connected and for OpenGL usage I can use CPU through MESA drivers. I'm not 100% sure if it possible and if I understand it well. But just for now it seems legit for me.

          Pablo J. RoginaP Offline
          Pablo J. RoginaP Offline
          Pablo J. Rogina
          wrote on last edited by
          #6

          @dariusz-o said in Run Qt GUI application inside docker.:

          this app have to do something with OpenGL in offscreen mode.

          Not sure why X server ended up being considered, when you goal is offscreen OpenGL.
          Anyway, I guess you may want to consider QOffscreenSurface

          Upvote the answer(s) that helped you solve the issue
          Use "Topic Tools" button to mark your post as Solved
          Add screenshots via postimage.org
          Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

          D 1 Reply Last reply
          0
          • Pablo J. RoginaP Pablo J. Rogina

            @dariusz-o said in Run Qt GUI application inside docker.:

            this app have to do something with OpenGL in offscreen mode.

            Not sure why X server ended up being considered, when you goal is offscreen OpenGL.
            Anyway, I guess you may want to consider QOffscreenSurface

            D Offline
            D Offline
            dariusz.o
            wrote on last edited by
            #7

            @Pablo-J-Rogina This app I want to run won't work without X, X are needed to create OpenGL context. In this case I have to adjust environment to app, not app to environment.

            Pablo J. RoginaP 1 Reply Last reply
            0
            • D dariusz.o

              @Pablo-J-Rogina This app I want to run won't work without X, X are needed to create OpenGL context. In this case I have to adjust environment to app, not app to environment.

              Pablo J. RoginaP Offline
              Pablo J. RoginaP Offline
              Pablo J. Rogina
              wrote on last edited by
              #8

              @dariusz-o said in Run Qt GUI application inside docker.:

              X are needed to create OpenGL context

              Not much expertise with graphic backends (X, OpenGL) but I do run Qt apps on RPi devices using fullscreen EGL without X server at all...

              So again, IMO it looks like your X server requirement seems at odds with the OpenGL requirement at some extent

              Upvote the answer(s) that helped you solve the issue
              Use "Topic Tools" button to mark your post as Solved
              Add screenshots via postimage.org
              Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

              D 1 Reply Last reply
              1
              • mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #9

                hi
                What version of Qt do you use ?
                After upgrading from 5.9 to 5.15 in Linux Mint
                i had to do
                sudo apt-get install --reinstall libxcb-xinerama0
                to fix the error
                qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
                when i tried to run Creator but not sure its the same as I didnt get
                "qt.qpa.xcb: could not connect to display"

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  dariusz.o
                  wrote on last edited by dariusz.o
                  #10

                  @mrjj I'm using Qt 5.12.2
                  I managed how to connect fake display with Xvfb :1 -screen 0 1024x768x16 .
                  This display works cuz I launched glxgears and I made screenshot with ImageMagick (gears were visable on it).

                  After I connected this virtual display I don't get "qt.qpa.xcb: could not connect to display" anymore. So I'm one step closer.

                  Now I'getting info like this

                  Got keys from plugin meta data ("xcb")
                  loaded library "/home/user/app/platforms/libqxcb.so"
                  loaded library "Xcursor"
                  QFactoryLoader::QFactoryLoader() checking directory path "/home/user/app/platformthemes" ...
                  QFactoryLoader::QFactoryLoader() checking directory path "/home/user/app/platforminputcontexts" ...
                  QFactoryLoader::QFactoryLoader() checking directory path "/home/user/app/styles"
                  

                  I got all those catalogs at /opt/Qt/5.12.2/gcc_64/plugins/ and I added this path to LD_LIBRARY_PATH I'm not sure why it suggests me that those catalogs are missed.

                  1 Reply Last reply
                  0
                  • Pablo J. RoginaP Pablo J. Rogina

                    @dariusz-o said in Run Qt GUI application inside docker.:

                    X are needed to create OpenGL context

                    Not much expertise with graphic backends (X, OpenGL) but I do run Qt apps on RPi devices using fullscreen EGL without X server at all...

                    So again, IMO it looks like your X server requirement seems at odds with the OpenGL requirement at some extent

                    D Offline
                    D Offline
                    dariusz.o
                    wrote on last edited by
                    #11

                    @Pablo-J-Rogina But do your apps on RPi use OpenGL context, shaders, etc. ?

                    Pablo J. RoginaP 1 Reply Last reply
                    0
                    • D dariusz.o

                      @Pablo-J-Rogina But do your apps on RPi use OpenGL context, shaders, etc. ?

                      Pablo J. RoginaP Offline
                      Pablo J. RoginaP Offline
                      Pablo J. Rogina
                      wrote on last edited by
                      #12

                      @dariusz-o said in Run Qt GUI application inside docker.:

                      But do your apps on RPi use OpenGL context, shaders, etc. ?

                      I really don't know...

                      Upvote the answer(s) that helped you solve the issue
                      Use "Topic Tools" button to mark your post as Solved
                      Add screenshots via postimage.org
                      Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                      1 Reply Last reply
                      0
                      • D Offline
                        D Offline
                        dariusz.o
                        wrote on last edited by
                        #13

                        @Pablo-J-Rogina @mrjj

                        Ok, setting virtual display with Xvfb :1 -screen 0 1024x768x16 & and setting variables:

                        ENV QT_DEBUG_PLUGINS=1
                        ENV QT_QPA_PLATFORM=xcb
                        ENV QT_QPA_PLATFORM_PLUGIN_PATH=/opt/Qt/${QT_VERSION}/gcc_64/plugins
                        ENV QT_PLUGIN_PATH=/opt/Qt/${QT_VERSION}/gcc_64/plugins
                        ENV DISPLAY=:1
                        

                        solved everything!
                        It finally works ! :)

                        Thanks for yours interest!

                        1 Reply Last reply
                        3

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved