How to connect nodes in docker to remote master?
I have two machines A and B in the same network.
A is running roscore
on address http://192.168.1.101:11311 , and running a node, say rospy_tutorials listener.py
B is running docker container for some other nodes, say ros_tutorials talker.py
.
I have tried to use --env ROS_MASTER_URI=http://192.168.1.101:11311
on machine B, but the roscore
on A can not detect the correct address for the node inside docker on B. I suppose the docker is blocking all ports by default.
How should I set up the docker parameter so that everything works?
Using multiple containers is no different from using multiple machines: you need to make sure to either not use hostnames anywhere (set
ROS_IP
), or make sure all containers can resolve hostnames successfully. Also: make sure you have your containers share a network (docker0
or something else).Maybe related: Listening to ROS messages in Docker containers.
@gvdhoom I tried to set
ROS_IP
for every node, still not working. If every nodes are launched by docker, then thing works. But note that some nodes are running on remote machines (inside same LAN) other than docker host, the problem occurs.@gvhoom My guess is that ROS requires bi-directional connection on all ports for all nodes. But docker shield the nodes inside containers from receiving/sending messages on arbitrary port.
This may be related: Exposing ROS Containers to Host Machine
Not sure of a way to do that; web apps normally just expose single ports to host. you'd almost need the container's IP to resolve from that 192... domain