Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Qt app UI elements randomly rendered as blank/black in Docker

Qt app UI elements randomly rendered as blank/black in Docker

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
c++qtcreatordocker
8 Posts 7 Posters 2.2k Views
  • 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.
  • G Offline
    G Offline
    Geeva
    wrote on last edited by
    #1

    I prepared Dockerfile to build Docker image of my Qt application. To run the application I use X - I enable access to X server (xhost +local:root) , then I use the following command to run it:

    docker run -it --env="DISPLAY" --env="QT_X11_NO_MITSHM=1" \
        --volume="/tmp/.X11-unix:/tmp/.X11-unix:rw" mindforger:latest mindforger
    

    The problem is that some Qt UI elements (menu items, dialogs, ...) are rendered blank in black (randomly) - check the screenshot below:

    0_1557485402329_0a31cb9c-64a6-46e8-9085-a40b64f67ae1-image.png

    I'm on Ubuntu 16.04.5 with Docker 18.06 and Qt 5.01.

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      But... why? Why docker?

      Anyway. Do other applications show normally? Like some standard Gnome/KDE apps.

      I strongly recommend using something newer than Qt 5.0.1. It was an extremely buggy release. And it's super old.

      (Z(:^

      1 Reply Last reply
      2
      • L Offline
        L Offline
        lduboeuf
        wrote on last edited by
        #3

        I have the same with Ubuntu 16.04 on Docker and Qt Creator 4.5.2

        mrjjM 1 Reply Last reply
        0
        • L lduboeuf

          I have the same with Ubuntu 16.04 on Docker and Qt Creator 4.5.2

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @lduboeuf
          Hi
          Nothing we can do about it. Its a docker issue.

          Make sure you run a full Linux with X server etc inside the docker.
          Then i had no issues running my app.

          If you use a special docker, it might have side effects as not operating like a normal OS would.

          Z 1 Reply Last reply
          3
          • K Offline
            K Offline
            Kshepitzki
            wrote on last edited by
            #5

            Geeva, was this ever solved?
            I get the same problem with Qt 5.9.5, Ubuntu 18.04.6, GCC 7.5.0, Docker 20.10.14

            Z 1 Reply Last reply
            0
            • mrjjM mrjj

              @lduboeuf
              Hi
              Nothing we can do about it. Its a docker issue.

              Make sure you run a full Linux with X server etc inside the docker.
              Then i had no issues running my app.

              If you use a special docker, it might have side effects as not operating like a normal OS would.

              Z Offline
              Z Offline
              ZhiCoeus
              wrote on last edited by
              #6

              @mrjj Do you mean to install X server in the image?

              1 Reply Last reply
              0
              • K Kshepitzki

                Geeva, was this ever solved?
                I get the same problem with Qt 5.9.5, Ubuntu 18.04.6, GCC 7.5.0, Docker 20.10.14

                Z Offline
                Z Offline
                ZhiCoeus
                wrote on last edited by
                #7

                @Kshepitzki I try to add --ipc host to the run command,and fix this issus; Here is the distilled run command that I used;

                docker run --ipc host -e DISPLAY -e XAUTHORITY -h "$HOSTNAME" -u "$(id -u):$(id -g)" --device /dev/dri/card0 -v /dev/dri/card0:/dev/dri/card0 -v /tmp/.X11-unix:/tmp/.X11-unix -v "$XAUTHORITY:$XAUTHORITY" my-qt-app

                J 1 Reply Last reply
                1
                • Z ZhiCoeus

                  @Kshepitzki I try to add --ipc host to the run command,and fix this issus; Here is the distilled run command that I used;

                  docker run --ipc host -e DISPLAY -e XAUTHORITY -h "$HOSTNAME" -u "$(id -u):$(id -g)" --device /dev/dri/card0 -v /dev/dri/card0:/dev/dri/card0 -v /tmp/.X11-unix:/tmp/.X11-unix -v "$XAUTHORITY:$XAUTHORITY" my-qt-app

                  J Offline
                  J Offline
                  jack_gs
                  wrote on last edited by
                  #8

                  @ZhiCoeus it works!!!i test on ubuntu 16.04 and 20.04 , thanks!!!!

                  1 Reply Last reply
                  0

                  • Login

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