Docker Community Forums

Share and learn in the Docker community.

Binding container to alternate IP address on host network interface, UDP binding failure

(Tivomaker) #1

I’ve added a second IP address to my network interface. In general, port binding appears to work ok. However, certain UDP ports are bound to host ports on which another process is listening at address as well, in order to pick up all broadcasts on that port.

That should be OK, as long as all the programs involved open the port to be bound with SO_REUSEADDR (on Linux).

Docker apparently does not set this flag, so the container fails to start with the infamous error:

Error starting userland proxy: listen udp bind: address already in use

Is there anyway to get Docker to set the proper option to bind to such a UDP port?

(And yes, as you might surmise, this is running two different Samba configurations on different IP addresses on the same interface, one in a container, one hosted. As per Samba documentation, nmbd always binds to the address on the interface, but sets SO_REUSEDADDR. I actually wrote a quick program to test connecting to the port, and it indeed works fine. As per the Samba Wiki, multiple hosted servers run fine, with proper configuration, on the exact same kind of network setup. Only difference here is Docker).