I'm building a project which uses an api which will be running as a service or iisexpress (depends when running on windows, or linux)
while my dashboard application is running in a docker container.
If my dashboard is running in the container and my api is running from the exe(kestrel) than i'm not able to call my api.
I assume that it is because the internal docker network cannot find the host addresses?
what I have tried:
var result = new Host();
using (HttpClient client = new HttpClient())
{
var response = await client.GetAsync("http://192.168.0.196:5000/api/host");
var content = await response.Content.ReadAsStringAsync();
result = JsonConvert.DeserializeObject<Host>(content);
}
the ip address given is the host ip address of my computer, because i want to test it locally.
version: '3.4'
services:
dashboard:
image: ${DOCKER_REGISTRY-}dashboard
container_name: Dashboard
build:
context: .
dockerfile: Dashboard/Dockerfile
ports:
- "1433:1433"
docker -compose that currently maps 1433 for the database
How can I call an external api from within the container?