Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Problem connecting to docker container using gzclient

I'm trying to connect to gzserver running in a docker container and I'm running into trouble starting gzclient. I can run the demo pendulum simulation from gazebo's docker hub page, and I can get the logs just fine and play them back. The problem is connecting to gzserver from the host machine. The strange thing is, I can start gzserver just fine, but I can't seem to start up gzclient. It just hangs on startup and the splash screen never goes away. Usually if I leave it for ~10 minutes, it will exit with the error below.

With the container running, port 11345 published, and $GAZEBO_MASTER_URI=localhost:11345, gazebo will not start because it detects a conflict with the other server.

$ gazebo --verbose debug:=true
Gazebo multi-robot simulator, version 8.0.0
Copyright (C) 2012 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

[Msg] Waiting for master.
Gazebo multi-robot simulator, version 8.0.0
Copyright (C) 2012 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

[Err] [Master.cc:96] EXCEPTION: Unable to start server[bind: Address already in use]. There is probably another Gazebo process running.

[Err] [Master.cc:96] EXCEPTION: Unable to start server[bind: Address already in use]. There is probably another Gazebo process running.

When you stop the docker container, gazebo and gzserver will start.

$ gazebo --verbose --play ./logs/log/*/gzserver/state.log debug:=true
Gazebo multi-robot simulator, version 8.0.0
Copyright (C) 2012 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

[Msg] Waiting for master.
Gazebo multi-robot simulator, version 8.0.0
Copyright (C) 2012 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

[Msg] Waiting for master.
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Publicized address: 192.168.0.5
[Msg]
Log playback:
  Log Version: 1.0
  Gazebo Version: 8.0.0
  Random Seed: 3419886574
  Log Start Time: 0 388000000
  Log End Time: 10 741000000
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Publicized address: 192.168.0.5

However, if you try to run gzclient when the docker container is up, you get the following result:

$ gzclient --verbose debug:=true
Gazebo multi-robot simulator, version 8.0.0
Copyright (C) 2012 Open Source Robotics Foundation.
Released under the Apache 2 License.
http://gazebosim.org

[Msg] Waiting for master.
[Msg] Connected to gazebo master @ http://127.0.0.1:11345
[Msg] Publicized address: 192.168.0.5
[Wrn] [Publisher.cc:141] Queue limit reached for topic /gazebo/default/user_camera/pose, deleting message. This warning is printed only once.

And then after ~10 minutes:

libc++abi.dylib: terminating with uncaught exception of type boost::exception_detail::clone_impl<boost::exception_detail::error_info_injector<boost::lock_error> >: boost: mutex lock failed in pthread_mutex_lock: Invalid argument
Abort trap: 6

I've tried every viable combination of the environment variables I know. This one is the only one where gzclient doesn't exit with an error code. I've tried every trick with docker that I know, and it isn't a problem with published ports. I can access static webpages from containers on the same docker network just fine. Gzserver is running fine because I can run simulations in the container where it is running. It's a matter of not being able to connect to the server from the host. I'm hoping someone has experience with this. Any suggestions?