I checked that ROS_DOMAIN_ID is the same for all nodes. (ROS_DOMAIN_ID = 0)
After tinkering with ROS and docker I found the solution to my problem. It is not a ZED SDK problem but a FastDDS one.
Using the ros pub/sub example in different containers I encountered the same issue. After just removing the –network host option I was able to discover and communicate between the nodes in the different containers. Yet now I cannot use in a remote node, so after searching the web a found this Stack Exchange post wich explained the following:
Using --net=host implies both DDS participants believe they are in the same machine and they try to communicate using SharedMemory instead of UDP. Fast-DDS team will work in to implement a mechanism to detect this kind of situation.
However mapping /dev/shm into the docker container while using –network hostdid not work. Which is rare because just removing the –network host worked perfectly in the local container, the reason for this behaviour is yet unknown to me.
The comment bellow pointed about setting the FastDDS transport to UDP
Setting FASTDDS_BUILTIN_TRANSPORTS=UDPv4 can be helpful.
Using this as an environment variable did the trick and allowed me to use them both in local containers and remote ones. But i guess at the expense of losing the performance boost of using shared memory.
I hope someone finds this useful if they are in the same use case.