I'm working with ros noetic in ubuntu 20.04 with docker desktop. I'm specifically running this package, which runs a back-end for a multi-robot SLAM system. According to the authors, they have to run one of the front-end algorithms, VINS-Fusion, inside docker with ros melodic, which they made here.

To run, from the host PC I run these commands in 3 separate terminals:

rosrun covins_backend covins_backend_node
rosbag play MH_01_easy.bag /cam0/image_raw:=/cam0/image_raw0 /cam1/image_raw:=/cam1/image_raw0 /imu0:=/imu0 --start 45
  • As shown above, it's essentially roscore, running their backend node, and playing a bag file with some topic remapping.

From docker:

  • Essentially this runs a bash script shown here that runs a container of their docker image and as shown in line 48, it launches the frontend node of VINS-Fusion.

The main issue is that the node in the docker container can't see anything from the host PC and vice-versa, even though it should subscribe to the topics from the bag file I played above. One thing I do note is that the backend node run from the host PC has an output selectserver: new connection from on socket 11 which shows that it does connect to the frontend from docker (although this isn't ROS, showing docker seems to work fine, but the ROS connection isn't).

After looking online, I've found the following discussions:

  • 298602. Answer says to use --net=host but as shown in the bash script file above it already runs the docker image with that argument. Main point though is that all nodes should be running from the same distribution.
  • 318939 and 102816. Both involve changing the environment variables ROS_MASTER_URI, ROS_IP, and ROS_HOSTNAME.

I tried following the answers above and changing the environment variables above in every combination (using my IP address, localhost, or even the IP address from the docker image) but can only get certain things working like seeing nodes created from the docker in the host pc. The best working combination, given that my host PC has ROS_MASTER_URI= and ROS_IP= is to set the ROS_MASTER_URI of the docker container to the same as the host pc, before launching the ROS script.

  • With this setup, I can see all nodes created from both docker/host, from terminals of docker/host, and if I publish a simple topic from the host's command line (rostopic pub -r 500 /test std_msgs/String "Hello from Host"), I can echo this from the docker. However, the frontend node from docker still isn't subscribing to the image topics from the bag file in the host pc.
  • A few things I notice are that even though I see the docker nodes from the host pc, if I type rosnode info <docker node>, I get the output (all the info), but at the end, it gives the error message contacting node http://docker-desktop:57771/ ... ERROR: Communication with node[http://docker-desktop:57771/] failed!.
  • rqt_graph shows that every node from docker is "unreachable", highlighted in red, as shown below. This is strange considering even the /rostopic_688_1715111164941 node, which simply echos the host topic I mentioned above works perfectly fine. enter image description here.

I also tried this same setup but also changing ROS_IP, which was empty before, to, but this results in the following error message when launching the ros node:

RLException: Unable to contact my own server at [].
This usually means that the network is not configured properly.

A common cause is that the machine cannot connect to itself.  Please check
for errors by running:


From the ROS wiki, I checked the definition of the variables, but I didn't see any additional info that could be useful. From answers like here, it gives a clear definition that setting ROS_MASTER_URI before launching a node will tell the node where the master is, which is what I'm already doing in the docker container (look for ROS_MASTER_URI from the host pc.)

Sorry if this is a long question, but I'm just looking for guidance on the ROS side of things (I'll probably open an issue on their github for concrete answers). I can only think the real issue is the different distributions (melodic/noetic) (although I think I had this setup working on a previous PC, although I don't remember what I did).

EDIT: See my own answer below, which seemed to fix the issue.


  • $\begingroup$ HI GShim23, I think that your last edit, should be posted as an answer (rather than an edit to the question), as it does (maybe partially) solve your issue. And now that you've partially solved your issue, you now have a slightly different issue, that (probably) should be asked as a new question. The (overall) issue with your question, seems to be, that it is (as you say) a long question, and probably included a number of different issues (which may make it different to solve in one answer). Hopefully that makes sense. In short, it seems like you may need to break it down into smaller Qs. $\endgroup$ Commented May 10 at 20:31

1 Answer 1


After looking at more threads concerning other topics (such as editing /etc/hosts of the docker container), I managed to get it to work by only having to change ROS_MASTER_URI of the docker, and playing the bag file before the node from the docker launches. Then, everything works fine and I get the outputs I need. Now, I'm wondering why the publisher must play before the subscriber starts. This is a similar issue, but the opposite of the dilemma that issue 298602 had (they needed the subscriber to start before the publisher). My only problem now is figuring out why this strange behaviour occurs. I want to make sure subscribers are up before publishing, otherwise I would waste frames from my bag file. I couldn't get it to work using the --wait-for-subscribers flag from rosbag play, but I did get it to work with --pause (i.e. subscriber will start up fine even without any images published, then I can press space to start publishing from the start), however, this is tedious and adds another step.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.