osrf / docker_images

A repository to hold definitions of docker images maintained by OSRF
Apache License 2.0
577 stars 172 forks source link

qt.qpa.xcb: could not connect to display :1 #740

Closed fabriros closed 7 months ago

fabriros commented 7 months ago

Description:

I have tried to execute ros in a docker container on vscode. I have followed the tutorial at this page . I have a problem in visualizing rviz2.

Environment:

Expected behaviour

Open rviz2 through vscode

Actual behaviour

Error: `qt.qpa.xcb: could not connect to display :1 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.

Aborted`

My files

devcontainer.json Docker file: Screenshot from 2024-04-30 12-35-48

Thank you in advance!

ahcorde commented 7 months ago

Try to run before you launch the docker container: xhost local:root

Please open questions like this on https://robotics.stackexchange.com/questions/tagged/ros, which is our central Question and Answer site. You'll get a better answer there, and it will be searchable for the future.

Make sure to include a lot of information on what platform you are using, which ROS distribution you are using, and the exact steps you took.

DaveCollinsJr commented 3 months ago

Running the xhost local:root command locally before I built the container solved this problem for me.

Try to run before you launch the docker container: xhost local:root