gpt4 book ai didi

docker - 拒绝 127.0.0.1 :5672 Rabbit-mq with docker compose

转载 作者:行者123 更新时间:2023-12-02 20:37:27 26 4
gpt4 key购买 nike

我无法将 node.js 应用程序与 rabbit-mq 服务器连接起来。 Postgres 已正确连接。我不知道为什么我的连接被拒绝。

version: "3"
networks:
app-tier:
driver: bridge

services:
db:
image: postgres
environment:
- POSTGRES_USER=dockerDBuser
- POSTGRES_PASSWORD=dockerDBpass
- POSTGRES_DB=performance
ports:
- "5433:5432"
volumes:
- ./pgdata:/var/lib/postgresql/data
networks:
- app-tier

rabbitmq:
image: rabbitmq:3.6.14-management
healthcheck:
test: ["CMD", "curl", "-f", "http://127.0.0.1:5672"]
interval: 30s
timeout: 10s
retries: 5
ports:
- "0.0.0.0:5672:5672"
- "0.0.0.0:15672:15672"
networks:
- app-tier
app:
build: .
depends_on:
- rabbitmq
- db
links:
- rabbitmq
- db
command: npm run startOrc
environment:
DATABASE_URL: postgres://dockerDBuser:dockerDBpass@db:5432/asdf
restart: on-failure
networks:
- app-tier

似乎它正在尝试连接到主机 rabbitmq 而不是容器 rabbitmq

最佳答案

尝试更改环境变量 CLOUDAMQP_URLamqp://rabbitmq:5672
您可以通过其名称调用服务,即 rabbitmq .

关于docker - 拒绝 127.0.0.1 :5672 Rabbit-mq with docker compose,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53261142/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com