1
我想在我的容器中使用rabbitmq。我安裝了所需的庫,然後嘗試創建BlockingConnection,但失敗。當我在任何虛擬機或物理主機上嘗試它時,也是如此。它僅以容器失敗。具體操作步驟如下: -pika.BlockingConnection()失敗容器內,在虛擬機內運行良好
安裝所需的軟件包: -
$ docker run -it ubuntu:15.10 /bin/bash
[email protected]#
[email protected]# sudo apt-get -y install python-pip rabbitmq-server wget \
&& pip install pika
接下來,我試圖創建一個BlockingConnection,但它失敗。雖然同樣的事情在虛擬機上工作。
[email protected]# 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圖像。任何關於此的反饋將會非常有幫助。
您是否試過使用官方rabbitmq圖片? https://hub.docker.com/_/rabbitmq/ – cantSleepNow
謝謝。是的,我做到了。他們似乎在他們的dockerfile中做了很多東西,我不想那麼做。我想爲了特定目的而擁有自己的最小圖像。 – Rahul