title: how to call api endpoint inside docker container?
body: <p>My action endpoints are usually <a href="http://localhost:50000/Method/egFunction" rel="noreferrer">http://localhost:50000/Method/egFunction</a> but when I run the app on a docker container, I am not able to call the api endpoint, I get errors instead. I use docker-compose and here is my code (mongodb also doesn't work yet, I'm trying to get the endpoint working first).</p>
  
  <p>I always used docker-compose up to run the app, but ever since I implemented the restful api's and a database, I might have to change the way to run the command, not sure though. If I do docker-compose up the front-end loads fine but I have no data, and every call to the endpoint gives me an error. I usually load the docker container with this link: <a href="http://192.168.99.100:8080" rel="noreferrer">http://192.168.99.100:8080</a></p>
  
  <p>I have this in the docker-compose.yml:</p>
  
  <pre><code>version: '3.4'
  
  services:
    app:
      image: vinnie_app:latest
      links:
        - mongodb
      depends_on:
        - mongodb
    mongodb:
      image: mongo:latest
      container_name: "mongodb"
      ports:
        - 27017:27017
  </code></pre>
  
  <p>In my docker-compose.override.yml file I have this:</p>
  
  <pre><code>version: '3.4'
  
  services:
    app:
      build: ./app
      environment:
        - ASPNETCORE_ENVIRONMENT=Staging
        - NODE_ENV=staging
      ports:
        - "8080:80"
  </code></pre>
  
  <p>dockerfile:</p>
  
  <pre><code>FROM microsoft/dotnet:sdk AS build-env
  WORKDIR /app
  
  RUN curl -sL https://deb.nodesource.com/setup_10.x |  bash -
  RUN apt-get install -y nodejs
  
  # Copy csproj and restore as distinct layers
  COPY *.csproj ./
  RUN dotnet restore
  
  # Copy everything else and build
  COPY . ./
  RUN dotnet publish -c Release -o out
  
  # Build runtime image
  FROM microsoft/dotnet:aspnetcore-runtime
  WORKDIR /app
  COPY --from=build-env /app/out .
  ENTRYPOINT ["dotnet", "app.dll"]
  </code></pre>