C
C#9mo ago
Corn

Docker-compose not working with localhost redirect

I'm kinda new with docker and yarp so I probably made some basic mistake. For context: I have a yarp gateway created in asp.net core web api and a micro-service also in asp.net core web api. When I go to the gateway url I want it to redirect to the micro-service. I was able to get this to work in two seperate containers. However when I try to use docker-compose it wont work. The error I get the most is (http error 503) cannot assign requested address from my docker container. I have tried host.docker.internal but it yielded no results.
System.Net.Http.HttpRequestException: Cannot assign requested address (localhost:5101)
2024-03-12 10:06:02 ---> System.Net.Sockets.SocketException (99): Cannot assign requested address
System.Net.Http.HttpRequestException: Cannot assign requested address (localhost:5101)
2024-03-12 10:06:02 ---> System.Net.Sockets.SocketException (99): Cannot assign requested address
I can't send the rest of the code as it's too long for this message xd It can be viewed here however "https://stackoverflow.com/questions/78145912/docker-compose-not-working-with-localhost-redirect"
Stack Overflow
Docker-compose not working with localhost redirect
I'm kinda new with docker and yarp so I probably made some basic mistake. For context: I have a yarp gateway created in asp.net core and a micro-service also in asp.net core. When I go to the gatew...
2 Replies
Pobiega
Pobiega9mo ago
when running inside docker compose, services can refer to eachother by their service name as dns names so posting-service could reach gateway via http://gateway
Corn
CornOP9mo ago
I managed to fix it through using host.docker.internal in the end. There was a setting inside docker desktop that I hadn't enabled.
Want results from more Discord servers?
Add your server