Opening ports with docker-compose.yml

asked 2020-10-22 07:57:35 -0500

KenYN gravatar image

There's a number of existing posts on how to set up simple Docker, but I'm using docker-compose.yml to start up my nodes on two different machines. The relevant part of the file is:

# I'm using whatever the default is - host didn't work
# network_mode: "host"
ports:
    - "11311:11311"

First question, is which IP address do I use in ROS_IP and ROS_MASTER_URI? Inside Docker hostname -I gives me 172.18.0.2, but outside I get 10.x.y.z. The other machine gives me 172.18.0.2 and 10.x.y.w (both machines sit on the same physical segment), and some basic communication happens, but soon after startup the client nodes start dying and the roscore machine logs in master.log errors like this:

[rosmaster.master][INFO] 2020-10-22 21:48:40,406: +PUB [/some_topic] /xxdr_nodelet_manager http://172.18.0.2:46801/
[rosmaster.master][INFO] 2020-10-22 21:48:40,411: publisherUpdate[/some_topic] -> http://172.18.0.2:37227/ ['http://172.18.0.2:46801/']
[rosmaster.master][INFO] 2020-10-22 21:48:40,412: publisherUpdate[/some_topic] -> http://172.18.0.2:37227/ ['http://172.18.0.2:46801/']: sec=0.00, exception=[Errno 111] Connection refused

Do I need to open more ports through docker-compose.yml? What range should I use? Or where else might the problem be?

edit retag flag offensive close merge delete

Comments

See related questions on using the host network interface with ROS: https://answers.ros.org/question/2500...

ruffsl gravatar image ruffsl  ( 2020-10-25 03:20:44 -0500 )edit

Yes, I'd already studied that one, but that only seems to be a partial solution that doesn't work for me.

KenYN gravatar image KenYN  ( 2020-10-25 23:45:44 -0500 )edit

I'm still investigating this, but docker swarm seems to be what I am looking for.

KenYN gravatar image KenYN  ( 2020-10-27 23:55:24 -0500 )edit