Exposing ROS Containers to Host Machine
I've been corresponding with a few people interested in exposing containers (on a docker network) running ros nodes to the host machine. I believe I've stumbled across a viable solution using resolvable. However, I am uncertain on exactly why it works:
- Is this specific to a recent releases of Docker?
- Is this a result of adding DNS entries for the Docker bridge interface address?
- Is something about passive FTP failing without it?
Here is the gist with my complete description of the proposed solution and a small bit of exploration into the issue: gist.github.com/ruffsl/4a24c26a1aa2cc733c64
Since the introduction of docker networking in v1.7, with the advent of libnetwork, I've not had an issue rostopic-echo'ing between containers within the same defined docker network. The issues I did have were avoiding the need to hard-code IP's into environment variables, which is why I happened to quote docker's internal DNS improvement in v1.10 for host names.
Rostopic-echo'ing from outside that network was an entirely different matter, and up until now I hadn't thought if it easally feasible, short-of exposing the network via custom a network bridge docker-plugin or some dummy vpn container. Perhaps the solution I've found using resolvable is not v1.10 specific, but without the resolvable project's gateway resolver, I observed the same behavior described in this status document in the references, i.e:
- one could ping the containers from the host
- one could ping the host back from the containers
- one could set the ROS_MASTER_URI to point to the "master container"
- one could list rostopics published by the master from host
- but yet, one could not successfully receive subscribe topics from host
I've extended my gist example to include some of my experimentation that lead me to the my thought process on why I think it has to do with Resolvable's provision of a DNS entry for the Docker bridge interface. From my brief poking and prodding using netcat, I don't think erroneous port remapping is the root of all evil here. As I'm not exposing or reassigning any ports as far as I'm aware of. Yet I certainly could be proven wrong and would find any evidence quite invaluable. Please let me know how if anyone can correct or dispel this hypothesis.
I thought that this deeper question on why this works (be it a corrected extension for passive FTP introduced by one of my changes) would be good question to ask of the larger ROS community, members with networking experience beyond my years.
You don't mention it, but have you tried setting
ROS_IP
on the sessions in your container? Set only that, notROS_HOSTNAME
, and make sure you haveROS_MASTER_URI
set to an IP as well. I would expect that with proper IP routes between the docker net and your host pc, it would work.