Connection Refuse (Use Ocelot API Gateway and Spring Cloud Eureka Discovery Service)

Hello. I try to study microservice architecture and use spring cloud eureka with ocelot gateway.
Before dockerize ocelot gateway it working but when i put it in container it pop error

Error making http request, exception: System.Net.Http.HttpRequestException: Connection refused ---> System.Net.Sockets.SocketException: Connection refused
         at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)

Error Code: UnableToCompleteRequestError Message: Error making http request, exception: System.Net.Http.HttpRequestException: Connection refused ---> System.Net.Sock
ets.SocketException: Connection refused

So i try logs on Ocelot container and check if it have problem with network in docker.
I install ping and curl on Ocelot Gateway containner and here is result

# curl --request GET http://service-a/api/values
["This Is Test Service A 1"]#
# curl --request GET http://service-a2/api/values
["This Is Service Test A 2222"]#
# curl --request GET http://service-b/api/values
["This IS SerVice Test BBBB"]#

then i check eureka service that is it give a correct endpoint to Ocelot

Microsoft.AspNetCore.Hosting.Internal.WebHost[1] Request starting HTTP/1.1 GET http://localhost:9100/service-a  


      GetInstances returning: Instance[InstanceId=service-a2:9501,HostName=service-a2,IpAddr=172.23.0.7,Status=UP,IsUnsecurePortEnabled=True,Port=9501,IsSecurePortEnabled=False,SecurePort=443,VipAddress=service-test-A,SecureVipAddress=service-test-A,ActionTy
pe=ADDED]
      GetInstances returning: Instance[InstanceId=service-a:9500,HostName=service-a,IpAddr=172.23.0.6,Status=UP,IsUnsecurePortEnabled=True,Port=9500,IsSecurePortEnabled=False,SecurePort=443,VipAddress=service-test-A,SecureVipAddress=service-test-A,ActionType
=ADDED]

requestId: 0HLGHA1ADHD30:00000002, previousRequestId: no previous request id, message: Downstream url is http://service-a2:9501/api/values

I consulted with TomPallister (Ocelot Gateway Owner) but still we can’t solve this problem,
Here the docker-compose and powershell command

docker-compose

version: '2.2'
services:
    eureka-server:
        container_name: eureka-server
        image: deadmandrive/eureka-server
        ports:
            - 8761:8761
        networks:
            - custom_network
            
    rabbitmq-server:
        container_name: rabbitmq-server
        hostname: "rabbitmq"
        image: rabbitmq:3-management
        environment:
            RABBITMQ_ERLANG_COOKIE: "SWQOKODSQALRPCLNMEQG"
            RABBITMQ_DEFAULT_USER: "rabbitmq"
            RABBITMQ_DEFAULT_PASS: "rabbitmq"
            RABBITMQ_DEFAULT_VHOST: "/"
        ports:
            - 15672:15672
            - 5672:5672
        labels:
            NAME: "rabbitmq"
        networks:
            - custom_network

    config-server:
        container_name: config-server
        image: deadmandrive/config-server
        ports:
            - 9000:8888
        networks:
            - custom_network
        environment:
            - EUREKA_CLIENT_SERVICEURL_DEFAULTZONE=http://eureka-server:8761/eureka
          
networks:
    custom_network:
        external:
            name: test-network

powershell Script

docker container stop $(docker ps -a -q)
docker container rm $(docker ps -a -q)
docker network create test-network
docker-compose up --build -d
Start-Sleep -s 30
docker run --name zipkin-server -p=9411:9411 --network test-network -d -e RABBIT_URI='amqp://rabbitmq:rabbitmq@rabbitmq-server:5672' openzipkin/zipkin

docker run --name service-a   -p=9500:80 --network test-network -d deadmandrive/servicea
docker run --name service-a2  -p=9501:80 --network test-network -d deadmandrive/servicea2
docker run --name service-b   -p=9600:80 --network test-network -d  deadmandrive/serviceb
docker run --name testocelot   -p=9100:80 --network test-network -d deadmandrive/testocelot


exit

Hi, did you find the issue? Because I’m stuck here too!