我正在尝试在容器中使用 rabbitmq。我安装了所需的库,然后尝试创建一个 BlockingConnection,但它失败了。当我在任何虚拟机或物理主机上尝试时,同样的事情。它仅对容器失败。以下是步骤:-
安装所需的软件包:-
$ docker run -it ubuntu:15.10 /bin/bash
root@d3d44e2656a9#
root@d3d44e2656a9# sudo apt-get -y install python-pip rabbitmq-server wget \
&& pip install pika
接下来,我尝试创建一个 BlockingConnection,但它失败了。不过,同样的事情在虚拟机上也有效。
root@d3d44e2656a9# python
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pika
>>> pika.BlockingConnection(pika.ConnectionParameters('127.0.0.1'))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/pika/adapters/blocking_connection.py", line 339, in __init__
self._process_io_for_connection_setup()
File "/usr/local/lib/python2.7/dist-packages/pika/adapters/blocking_connection.py", line 374, in _process_io_for_connection_setup
self._open_error_result.is_ready)
File "/usr/local/lib/python2.7/dist-packages/pika/adapters/blocking_connection.py", line 395, in _flush_output
raise exceptions.ConnectionClosed()
pika.exceptions.ConnectionClosed
>>>
我不确定容器内有什么问题。我为此使用 ubuntu:15.10 图像。对此的任何反馈都会非常有帮助。