Skip to content

Encountering QT_QPA_PLATFORM error when running code with Docker #3

@chrysanthemum-boy

Description

@chrysanthemum-boy

Hello,

I encountered the following error when running your code inside Docker (error details below).
I have searched extensively online and tried all suggested solutions but none resolved the issue.

I have tried the following:

  • Installed all missing OS dependencies

    • sudo apt install libxcb-cursor0
    • sudo apt-get install '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev
    • sudo apt-get install libxcb-xinerama0
    • ...
  • Set the environment variable export QT_QPA_PLATFORM=offscreen

  • Checked echo $DISPLAY, which outputs 1 confirming the display environment variable is set correctly

However, the problem persists.

My system information is:

Linux fann 6.8.0-60-generic #63~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Apr 22 19:00:15 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

Could you please help me understand what might be causing this basic issue? Thank you!

root@docker-desktop:~/project_rss24_demo# ros2 launch as2_gazebo_assets launch_simulation.py simulation_config_file:=platforms_config/gazebo/world.yaml
[INFO] [launch]: All log files can be found below /root/.ros/log/2025-06-19-00-33-58-375506-docker-desktop-1566
[INFO] [launch]: Default logging verbosity is set to INFO



[INFO] [ruby $(which ign) gazebo-1]: process started with pid [1572]
[INFO] [monitor_sim-2]: process started with pid [1574]
[INFO] [create-3]: process started with pid [1576]
[INFO] [create-4]: process started with pid [1578]
[INFO] [create-5]: process started with pid [1581]
[INFO] [parameter_bridge-6]: process started with pid [1583]
[parameter_bridge-6] [INFO] [1750293239.105837571] [world.ros_gz_bridge]: Creating GZ->ROS Bridge: [/clock (ignition.msgs.Clock) -> /clock (rosgraph_msgs/msg/Clock)] (Lazy 0)
[create-5] [INFO] [1750293239.284182501] [ros_gz_sim]: Requested creation of entity.
[create-5] [INFO] [1750293239.284411500] [ros_gz_sim]: OK creation of entity.
[ruby $(which ign) gazebo-1] qt.qpa.xcb: could not connect to display :1
[ruby $(which ign) gazebo-1] qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
[ruby $(which ign) gazebo-1] This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
[ruby $(which ign) gazebo-1] 
[ruby $(which ign) gazebo-1] Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.
[ruby $(which ign) gazebo-1] 
[ruby $(which ign) gazebo-1] Stack trace (most recent call last):
[ruby $(which ign) gazebo-1] #31   Object "ign gazebo gui", at 0x55da54d8317e, in 
[ruby $(which ign) gazebo-1] #30   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x7f4a5eaa8e19, in ruby_run_node
[ruby $(which ign) gazebo-1] #29   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x7f4a5eaa5317, in 
[ruby $(which ign) gazebo-1] #28   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x7f4a5ec3a30c, in rb_vm_exec
[ruby $(which ign) gazebo-1] #27   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x7f4a5ec34c96, in 
[ruby $(which ign) gazebo-1] #26   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x7f4a5ec31fc5, in 
[ruby $(which ign) gazebo-1] #25   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x7f4a5ec2fc34, in 
[ruby $(which ign) gazebo-1] #24   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x7f4a5eb7ba4e, in 
[ruby $(which ign) gazebo-1] #23   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x7f4a5eaa69ac, in rb_protect
[ruby $(which ign) gazebo-1] #22   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x7f4a5ec3ec61, in rb_yield
[ruby $(which ign) gazebo-1] #21   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x7f4a5ec3a30c, in rb_vm_exec
[ruby $(which ign) gazebo-1] #20   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x7f4a5ec34c96, in 
[ruby $(which ign) gazebo-1] #19   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x7f4a5ec31fc5, in 
[ruby $(which ign) gazebo-1] #18   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x7f4a5ec2fc34, in 
[ruby $(which ign) gazebo-1] #17   Object "/usr/lib/x86_64-linux-gnu/ruby/3.0.0/fiddle.so", at 0x7f4a5ed8b44b, in 
[ruby $(which ign) gazebo-1] #16   Object "/lib/x86_64-linux-gnu/libruby-3.0.so.3.0", at 0x7f4a5ebfd088, in rb_nogvl
[ruby $(which ign) gazebo-1] #15   Object "/usr/lib/x86_64-linux-gnu/ruby/3.0.0/fiddle.so", at 0x7f4a5ed8ad6b, in 
[ruby $(which ign) gazebo-1] #14   Object "/lib/x86_64-linux-gnu/libffi.so.8", at 0x7f4a5ed7c492, in 
[ruby $(which ign) gazebo-1] #13   Object "/lib/x86_64-linux-gnu/libffi.so.8", at 0x7f4a5ed7fe2d, in 
[ruby $(which ign) gazebo-1] #12   Object "/usr/lib/x86_64-linux-gnu/libignition-gazebo6-ign.so.6.16.0", at 0x7f4a5e46dbcc, in runGui
[ruby $(which ign) gazebo-1] #11   Object "/lib/x86_64-linux-gnu/libignition-gazebo6-gui.so.6", at 0x7f4a59cf7a75, in ignition::gazebo::v6::gui::runGui(int&, char**, char const*, char const*, int, char const*)
[ruby $(which ign) gazebo-1] #10   Object "/lib/x86_64-linux-gnu/libignition-gazebo6-gui.so.6", at 0x7f4a59cf63a0, in ignition::gazebo::v6::gui::createGui(int&, char**, char const*, char const*, bool, char const*, int, char const*)
[ruby $(which ign) gazebo-1] #9    Object "/lib/x86_64-linux-gnu/libignition-gui6.so.6", at 0x7f4a5ad9b068, in ignition::gui::Application::Application(int&, char**, ignition::gui::WindowType)
[ruby $(which ign) gazebo-1] #8    Object "/lib/x86_64-linux-gnu/libQt5Widgets.so.5", at 0x7f4a57f71cec, in QApplicationPrivate::init()
[ruby $(which ign) gazebo-1] #7    Object "/lib/x86_64-linux-gnu/libQt5Gui.so.5", at 0x7f4a56b3bb6f, in QGuiApplicationPrivate::init()
[ruby $(which ign) gazebo-1] #6    Object "/lib/x86_64-linux-gnu/libQt5Core.so.5", at 0x7f4a588c0b16, in QCoreApplicationPrivate::init()
[ruby $(which ign) gazebo-1] #5    Object "/lib/x86_64-linux-gnu/libQt5Gui.so.5", at 0x7f4a56b38c07, in QGuiApplicationPrivate::createEventDispatcher()
[ruby $(which ign) gazebo-1] #4    Object "/lib/x86_64-linux-gnu/libQt5Gui.so.5", at 0x7f4a56b38712, in QGuiApplicationPrivate::createPlatformIntegration()
[ruby $(which ign) gazebo-1] #3    Object "/lib/x86_64-linux-gnu/libQt5Core.so.5", at 0x7f4a58690ba2, in QMessageLogger::fatal(char const*, ...) const
[ruby $(which ign) gazebo-1] #2    Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7f4a5e6287f2, in abort
[ruby $(which ign) gazebo-1] #1    Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7f4a5e642475, in raise
[ruby $(which ign) gazebo-1] #0    Object "/lib/x86_64-linux-gnu/libc.so.6", at 0x7f4a5e6969fc, in pthread_kill
[ruby $(which ign) gazebo-1] Aborted (Signal sent by tkill() 1647 0)
[create-3] [INFO] [1750293239.385086483] [ros_gz_sim]: Requested creation of entity.
[create-3] [INFO] [1750293239.385258035] [ros_gz_sim]: OK creation of entity.
[INFO] [create-5]: process has finished cleanly [pid 1581]
[INFO] [create-3]: process has finished cleanly [pid 1576]
[create-4] [INFO] [1750293239.547165841] [ros_gz_sim]: Requested creation of entity.
[create-4] [INFO] [1750293239.547445690] [ros_gz_sim]: OK creation of entity.
[INFO] [create-4]: process has finished cleanly [pid 1578]
[ruby $(which ign) gazebo-1] Escalating to SIGKILL on [Ignition Gazebo Server]
[INFO] [ruby $(which ign) gazebo-1]: process has finished cleanly [pid 1572]
[INFO] [launch]: process[ruby $(which ign) gazebo-1] was required: shutting down launched system
[INFO] [parameter_bridge-6]: sending signal 'SIGINT' to process[parameter_bridge-6]
[INFO] [monitor_sim-2]: sending signal 'SIGINT' to process[monitor_sim-2]
[parameter_bridge-6] [INFO] [1750293249.311238663] [rclcpp]: signal_handler(signum=2)
[monitor_sim-2] Traceback (most recent call last):
[monitor_sim-2]   File "/root/aerostack2_ws/install/as2_gazebo_assets/share/as2_gazebo_assets/launch/monitor_sim.py", line 46, in <module>
[monitor_sim-2]     monitor_sim()
[monitor_sim-2]   File "/root/aerostack2_ws/install/as2_gazebo_assets/share/as2_gazebo_assets/launch/monitor_sim.py", line 35, in monitor_sim
[monitor_sim-2]     time.sleep(1)
[monitor_sim-2] KeyboardInterrupt
[ERROR] [monitor_sim-2]: process has died [pid 1574, exit code -2, cmd 'python3 /root/aerostack2_ws/install/as2_gazebo_assets/share/as2_gazebo_assets/launch/monitor_sim.py'].
[INFO] [parameter_bridge-6]: process has finished cleanly [pid 1583]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions