python – ZeroMQ在[]上的Docker上无法使用.bind() – 已经在使用的地址.为什么?

尝试在0.0.0.0:5555地址尝试.bind()时,尝试通过Rancher Cattle在Docker容器中运行它时,ZeroMQ套接字有点问题.


zmq.error.ZMQError: Address already in use.

试图在我的Dockerfile中做EXPOSE 5555和EXPOSE 5555 / tcp,但它没有帮助我.


self.context = zmq.Context()
self.socket = self.context.socket(zmq.PUB)
self.socket.bind('tcp://%s:%d' % ('', 5555))


ZeroMQ API定义了3种方法:

Assigning a local address to a socket

When assigning a local address to a socket using zmq_bind() with the tcp:// transport, the endpoint shall be interpreted as an interface followed by a colon and the TCP port number to use.

An interface may be specified by either of the following:

– The wild-card *, meaning all available interfaces.
– The primary IPv4 address assigned to the interface, in its numeric representation.
– The interface name as defined by the operating system.

Interface names are not standardised in any way and should be assumed to be arbitrary and platform dependent. On Win32 platforms no short interface names exist, thus only the primary IPv4 address may be used to specify an interface.


转载注明原文:python – ZeroMQ在[]上的Docker上无法使用.bind() – 已经在使用的地址.为什么? - 代码日志