Excellent article, and thank you for documenting this use case!
A question I have is whether it would be possible to retain the use of DDS Autodiscovery between ros2 containers across multiple docker hosts by attaching the containers to a shared virtual network with a common subnet? Thus, one could avoid the need to manually set the HOSTNAME or customize the default DDS configuration files for specific vendors.
I recall being able to achieve something like this using docker swarm: linking two or more docker hosts by joining the nodes via a common swarm, creating a dedicated virtual network in that swarm, then attaching the respective network interfaces to any spawned ROS2 containers. I suppose the same is just as feasible using kubernetes, but the idea of using a simple VPN service, as opposed to resorting to a full blown container orchestration framework, has its own appeal for remote development.
Ruffsl, thanks for the kind words about my article!
You asked a good question, because this will be a topic I’m going to cover in the next blog post . I will show how to combine a container orchestration for easy setup (probably I will base an example on k8s) with P2P VPN for a low latency connection between containers on different hosts (like shown in the article above).
When it comes to a DDS autodiscovery, I will also cover that topic, but still custom DDS configuration will be needed (hosts from the same VPN network will be automatically added).
By using an overlay network provided by docker swarm you can connect docker containers running on hosts in different networks, however the traffic will go through a host running swarm manager. If pings to the host running swarm manager are low, that’s fine, but the higher the traffic the larger the latency, and that central server dependency becomes the weakest link.
My goal in the article was to configure a p2p network, where traffic goes directly between devices, no matter if they are in the same or different networks, without dependency on any proxy server in between.
In the next article I’m going also to connect containers p2p over the internet. Thanks to container orchestrator you will be able to manage the whole system from a central element, keeping inter-container communication decentralized and based on p2p vpn.