'How to send UDP broadcasts from docker host to cocker containers?
I'm working on a p2p application that requires some discovery.
Each peer announces itself to the network by sending a message to 255.255.255.255. I was trying to run this app in docker, in order to fix some bugs, and though the peers could find each other without problems when all peers where on containers, the peers on the host were not being located.
After a few days investigating, I noticed that broadcast udp packets being sent by the containers where being received on the host without problem, but when the host send something on 255.255.255.255, it never reached the containers.
On host:
$nc -u 255.255.255.255 9999
Somestuff
On container:
#nc -l -u 9999
And nothing comes through.
If I repeat the same test, but sending data from another container instead of the host, or sending from the container to the host, the data comes through:
On container 1:
#nc -u 255.255.255.255 9999
Somestuff
On container 2:
#nc -l -u 9999
Somestuff
What am I doing wrong?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
