enter code here
Hi! I have 2 different microservice and I am running them on docker with the help of docker compose I have spring cloud gateway through which I am supposed to fetch or connect other microservice the problem is the gateway is giving 500 error but when I access api_1 through its designated port on docker like localhost:8083/Publish/message it gives message with out any hindrance,
This is the error I am getting when I am trying to connect gateway-service to 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:8083 Caused by: java.net.ConnectException: finishConnect(..) failed: Connection refused
Here is my 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
also tried to use this instead of localhost
http://[service_name]:[running_port]/
I tried an alternative as I figured like Each container is a separated host/machine I have to connect from the gateway host to service host still that error persisted and idk what is it that I am missing or doing wrong because I am really a newbie at docker and I don't know much about I have inspected the container they seems to fine
