ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

RViz2 in docker - error while starting

asked 2023-01-29 08:50:37 -0500

robin_rob96 gravatar image

Hi, I'm trying ros2-humble in a docker setup on my m1 mac.

So far, I got a devcontainer running and I can use gui tools like rqt, rqt_graph and that from turtlesim_node (tutorial). I'm therefore using XQuartz (In the xquartz terminal expose the ip: xhost + and in the docker container, I'm setting the env variable DISPLAY= as well. When I start GUI apps, XQuartz automatically opens and works fine!

But not with RViz2. I installed it with sudo apt-get install ros-humble-rviz2 within my running container. When I try to run with rviz2 or ros2 run rviz2 rviz2 I get the following error message:

[ERROR] [1675002518.131453001] [rviz2]: Failed to create an OpenGL context. BadValue (integer parameter out of range for operation)

[ERROR] [1675002518.131543001] [rviz2]: RenderingAPIException: Unable to create a suitable GLXContext in GLXContext::GLXContext at ./.obj-aarch64-linux-gnu/ogre-v1.12.1-prefix/src/ogre-v1.12.1/RenderSystems/GLSupport/src/GLX/OgreGLXContext.cpp (line 60)

[ERROR] [1675002518.131683460] [rviz2]: rviz::RenderSystem: error creating render window: RenderingAPIException: Unable to create a suitable GLXContext in GLXContext::GLXContext at ./.obj-aarch64-linux-gnu/ogre-v1.12.1-prefix/src/ogre-v1.12.1/RenderSystems/GLSupport/src/GLX/OgreGLXContext.cpp (line 60)

You should be able to reproduce with:

docker run -it --privileged -e DISPLAY= -e QT_X11_NO_MITSHM=1 --net=host  --name test-rviz2 ros:humble bash

Really appreciate some ideas :) Robin

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2023-01-30 07:24:27 -0500

Per Edwardsson gravatar image

Hi. Also using an M1 Mac. I never got the RQT suite of stuff to work very well on Mac via Docker, and barely even well running linux via docker. In general, making 3D work anything but natively can be tricky since different OS's use different drivers to produce 3D content. I would never _expect_ the Xorg 3D stuff to work on Mac.

I switched to Foxgloves suite of visualization tools instead, so far I think it works very well. I was never fond of Rviz anyway. See

edit flag offensive delete link more


Thanks, sounds nice!

What is your setup then? Nativ Ros2 installation? In my ros2-humble container i installed the foxglove-bridge and started that node, it outputs:

[foxglove_bridge-1] [INFO] [1675104718.387759591] [foxglove_bridge]: [WS] Server running without TLS

But when I try to connect to that adress, nothing connects (in the web view). Is there something I'm missing? Might be due to some port issues or so?

robin_rob96 gravatar image robin_rob96  ( 2023-01-30 12:59:21 -0500 )edit

Problem Solved:

turns out --net=host doesn't create the same effect on m1 mac, therefore

expose 8765 (Dockerfile) and maybe port forwarding with -p 8765:8765 is whats needed.

robin_rob96 gravatar image robin_rob96  ( 2023-02-02 09:49:05 -0500 )edit

Question Tools

1 follower


Asked: 2023-01-29 08:50:37 -0500

Seen: 611 times

Last updated: Jan 30 '23