[SOLVED] Gazebo_ros_camera doesn't work in Docker


Dear all,

I installed the NRP by using the Docker Installer. I found the Gazebo_ROS plugin “gazebo_ros_camera” doesn’t work and no corresponding rostopic could be found. But another one “gazebo_ros_p3d” works.

I need to gain images from the camera mounted on my robot. I add a camera in the model.sdf and it works well before using Docker.

  <sensor type="camera" name="camera">
    <camera name="robot_eye">
    <plugin name="camera_controller" filename="libgazebo_ros_camera.so">

Does anyone know how to solve this problem?



Hi Zhuangyi!

Have you tested the camera running one of the template experiments? The Husky Braitenberg experiment, for example.



Hi Ugo,

Yes, I have. When I ran the Husky Braitenberg experiment in docker, the rostopic “/husky/husky/camera” echoed nothing. I also tested other template experiments, but all failed.

Best regards,


Hi Zhuangyi,

it looks like some problem with your graphics driver setup. Could you enter the docker container and run the next command:

gzserver --verbose

then please share the output here.



Hi ercarrion43,

Yes, there really is a display error. But I still don’t know how to fix it.

bbpnrsoa@ebb2dc28cd8d:~/nrp/src$ gzserver --verbose
Gazebo multi-robot simulator, version 7.2.0.hbp.2.2.2
Copyright © 2012-2016 Open Source Robotics Foundation.
Released under the Apache 2 License.

[Msg] Waiting for master.
[Msg] Connected to gazebo master @
[Msg] Publicized address:
[Err] [RenderEngine.cc:699] Can’t open display:
[Wrn] [RenderEngine.cc:97] Unable to create X window. Rendering will be disabled
[Wrn] [RenderEngine.cc:301] Cannot initialize render engine since render path type is NONE. Ignore this warning ifrendering has been turned off on purpose.



@izy91 did you ever solve this problem? I have the same issue.

Running ROS Noetic in my Ubuntu VM and I have no issues with the camera and see these lines in the terminal:

[ INFO] [1610270432.293487831, 0.116000000]: Camera Plugin: Using the 'robotNamespace' param: '/'
[ INFO] [1610270432.299547451, 0.116000000]: Camera Plugin (ns = /)  <tf_prefix_>, set to ""

However, when doing the same thing inside a docker container (osrf/ros:noetic-desktop-full-focal) these lines just never appear and there is nothing in the logs about it - no camera topics are ever published and no errors are shown. I’ve tried apt-update and apt-upgrade to no avail…

I’ve been trying to figure this out for a few hours now and haven’t gotten anywhere, any help would be much appreciated!


ok I fixed it - @ercarrion43 you were absolutely right with your assumption. Here’s the solution:

docker run -it -p 7681:7681 -p 8080:8080 -e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix --name gui-test osrf/ros:noetic-desktop-full-focal /bin/bash

-e DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix -> being what I needed to do differently

Then run this on the host:

xhost local:docker

Reference: https://askubuntu.com/questions/1161646/is-it-possible-to-run-docker-container-and-show-its-graphical-application-window