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. Issues with Using Qt6 and OpenGL in Docker on Ubuntu 24.04
Forum Updated to NodeBB v4.3 + New Features

Issues with Using Qt6 and OpenGL in Docker on Ubuntu 24.04

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
1 Posts 1 Posters 212 Views 1 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.
  • R Offline
    R Offline
    Ribes
    wrote on last edited by
    #1

    Hello!

    I’m trying to run a Qt6 application that uses OpenGL inside a Docker container running Ubuntu 24.04, but I’m encountering issues with OpenGL rendering. Specifically, when trying to run an example from Qt6's OpenGL examples (2dpainting), I get the error:

    failed to create drawable
    failed to create drawable
    

    Additionally, there is a warning:

    QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
    

    When running the 2dpainting example, I get a black screen with no rendering, but when I run openglwindow example for the OpenGL context, it successfully displays the object. There are other examples like: hellogl2, textures, cube... that don't work.

    58f67a96-7f22-4448-b72f-7d5600ba552e-image.png

    52ffdf55-df5e-4b3b-8908-95b8ca15b057-image.png
    In addition, after installing mesa-utils and running glxgears, the gears render perfectly.

    13f2a4ab-2a59-4016-aee2-7d26bf57c0fb-image.png

    Here are the commands I run, as well as the Dockerfile I created to test it.

    $ docker build -t ubuntu24-qt6 .
    $ docker run -it --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix ubuntu24-qt6:latest
    
    # Latest LTS Ubuntu
    ARG BASE_IMAGE=ubuntu:24.04
    FROM $BASE_IMAGE
    
    # Unset to allow running qt interfaces.
    ENV QT_QPA_PLATFORM=""
    
    WORKDIR /home/ubuntu
    
    # install packages
    RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
        --mount=type=cache,target=/var/lib/apt,sharing=locked \
        apt update \
        && apt install -y --no-install-recommends \
    	qt6-base-dev \
    	qt6-base-examples \
        && rm -rf /var/lib/apt/lists/*
    

    Could you help me get Qt6 and OpenGL working in a Docker container on Ubuntu 24?

    Thank you in advance.

    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