gpt4 book ai didi

docker-compose - 使用 docker-compose 运行时,Spring Cloud Gateway 给出 500 错误 finishConnect(..) failed : Connection refused: localhost/127. 0.0.1:8083

转载 作者:行者123 更新时间:2023-12-05 06:47:16 33 4
gpt4 key购买 nike

enter code here

嗨!我有 2 个不同的微服务,我在 docker compose 的帮助下在 docker 上运行它们 我有 spring 云网关,我应该通过它获取或连接其他微服务问题是网关给出 500 错误但是当我通过它访问 api_1 docker 上的指定端口,如 localhost:8083/Publish/message 它可以毫无障碍地提供消息,

这是我在尝试将网关服务连接到 api_1 时遇到的错误

curl -v http://localhost:8081/Publish/message{"timestamp":"2021-04-19T12:57:27.400+0000","path":"/Publish/message","status":500,"error":"Internal Server Error","message":"finishConnect(..) failed: Connection refused: localhost/127.0.0.1:8083"}

or-http-epoll-5] a.w.r.e.AbstractErrorWebExceptionHandler : [d6036c7b] 500 Server Error for HTTP GET "/Publish/message"io.netty.channel.AbstractChannel$AnnotatedConnectException: finishConnect(..) failed: Connection refused: localhost/127.0.0.1:8083Caused by: java.net.ConnectException: finishConnect(..) failed: Connection refused

这是我的 docker-compose.yml

gateway-service:
image:cloudapi
port:"8081:8081"
depends_on:
api_1
api_2
api_1:
image : publishimages:latest
ports:"8083:8081"
depends_on
gateway-service
api_2:
image : mobileapi:latest
ports:"8084:8081"
depends_on
gateway-service

还尝试用这个代替本地主机

http://[service_name]:[running_port]/

我尝试了另一种选择,因为我认为每个容器都是一个单独的主机/机器,我必须从网关主机连接到服务主机,但错误仍然存​​在,我不知道我错过了什么或做错了什么,因为我真的docker 的新手,我不太了解我已经检查过他们似乎还不错的容器

最佳答案

enter image description here

如果您使用的是 Docker Desktop,我发现取消选择“使用 Docker Compose V2”选项可以解决我的问题。花了很长时间重新安装东西。在做任何大事之前绝对值得一试。

关于docker-compose - 使用 docker-compose 运行时,Spring Cloud Gateway 给出 500 错误 finishConnect(..) failed : Connection refused: localhost/127. 0.0.1:8083,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67168364/

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