ROS2 galactic nodes can't communicate through docker container border
This question is a direct follow up to this one: ROS2-foxy nodes can't communicate through docker container border
Recap in Foxy:
The following does not work
docker run -it --net=host --rm osrf/ros:foxy-desktop ros2 run demo_nodes_cpp talker
In Terminal 2:
docker run -it --net=host --rm osrf/ros:foxy-desktop ros2 run demo_nodes_cpp listener
The resolution was to mount the shared memory into both containers, because of how Fast-DDS works when it believes it's on the same machine:
In terminal 1:
docker run -it --net=host -v /dev/shm:/dev/shm --rm osrf/ros:foxy-desktop ros2 run demo_nodes_cpp talker
In terminal 2:
docker run -it --net=host -v /dev/shm:/dev/shm --rm osrf/ros:foxy-desktop ros2 run demo_nodes_cpp listener
Now back to ROS2 Galactic. AFAIK ROS2 Galactic uses Cyclone DDS, so the shared memory solution does not work anymore.
So what do i have to do to get the following to work?
In Terminal 1:
docker run -it --net=host --rm osrf/ros:galactic-desktop ros2 run demo_nodes_cpp talker
In Terminal 2:
docker run -it --net=host --rm osrf/ros:galactic-desktop ros2 run demo_nodes_cpp listener
I've kept trying this https://github.com/eclipse-cyclonedds... but this does not seem to work with --net=host. I'll look into it again though.
if Fast-RTPS suits your need better.. Keep in your mind that switching the DDS is pretty straight forward! See this great answer from here #post-id-349869