Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Using --net=host is indeed perhaps the simplest way of enabling ROS nodes across containers and host to easily communicate. Note that you will lose some degree of isolation for your containers given they would then share all the same network interfaces as the host. However, this allows the containers to communicate over the host's local loopback interface, avoiding the need to override any the default ROS URI IP environment venerable on either the host or container.

Here is an older but related question that addresses the same issue. Note however this question predates Docker v17.06 when the the host network driver was introduced, and thus approaches the issue differently. Had the host network driver existed, I would have just as well settled using that instead:

Side note: you should probably use the same distribution of ROS across all your nodes for compatibility, given that message types or minor APIs may have changed, resulting in more frustrating or subtle issues during run time.