简体   繁体   English

无法通过 docker 容器连接到 RabbitMQ

[英]Can't connect to RabbitMQ via docker container

I can't connect to RabbitMQ via docker file.我无法通过 docker 文件连接到 RabbitMQ。

After using docker run I'm getting使用 docker run 后,我得到了

pika.exceptions.AMQPConnectionError

That's line 14 and 15那是第 14 和 15 行

connection = pika.BlockingConnection(pika.ConnectionParameters(host=cfg.RABBIT_HOST))
channel = connection.channel()

and config file和配置文件

RABBIT_HOST= 'localhost'
QUEUE_TOPIC = 'topic_name'

connecting to localhost:15672 works and it's showing me rabbitmq login window, but still doesn't work with python connection连接到 localhost:15672 有效,它向我显示 rabbitmq 登录窗口,但仍然不适用于 python 连接

Ok, that was my fault.好吧,那是我的错。 Adding the credentials fixed the problem.添加凭据解决了问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM