-1

I have been trying to run Docker container on my laptop. When I run the command inside the container which GUI is required. I get the following error:

qt.qpa.xcb: could not connect to display :1.0
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, xcb.

[ros2run]: Aborted

What I expected to happen:

To see turtlesim on qt gui.

I run the following commands on host machine:

export DISPLAY=:1.0
xhost +local:docker
docker run -it --net=host -e DISPLAY=$DISPLAY -v $HOME/.Xauthority:/root/.Xauthority:ro osrf/ros:humble-desktop

I run the following commands inside the container:

source opt/ros/humble/setup.bash 
ros2 run turtlesim turtlesim_node

System Information:

Host OS: Ubuntu 22.04
Qmake: 3.1
Qt: 5.15.3
Docker ROS: Humble

I have tried the solutions in this link: QT6: "qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found."

THANK YOU FOR YOUR TIME

  • 1
    This seems like more of a generic Unix question than anything programming-related, and another site like [unix.se] might be a more appropriate place to ask. You should not need to run the dangerous `xhost` command at all; conversely, you do need to mount the X Unix socket into the container (if you have more than one X server, note that most recipes for this assume only the `:0` display exists). – David Maze Aug 18 '23 at 00:16
  • Not posting this as an answer, but I suggest to ask Google how to run X11 applications under docker. Random result https://l10nn.medium.com/running-x11-applications-with-docker-75133178d090 says `-v /tmp/.X11-unix:/tmp/.X11-unix` to make the socket accessible (and does not mention anything with `xhost`). – Uli Schlachter Aug 18 '23 at 18:26

0 Answers0