title: Docker compose specified port not mapping to connect to the health check endpoint
body: <p>I am a newbie to docker. This is the layout I am working with. I have 2 projects in the docker compose file. A dotnet6 web api and a mvc web app. In the web api startup.cs I have the following code to get health statuses using AspNetCore.HealthChecks.UI, If I browse to the endpoint I get a json object of health check values (this part works)</p>
  <pre><code>app.UseEndpoints(endpoints =&gt;
     {
      endpoints.MapControllers();
      endpoints.MapHealthChecks(&quot;/hc&quot;, new HealthCheckOptions
        {
          Predicate = _ =&gt; true,
          ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse
        });
    });
  </code></pre>
  <p>I have a WebStatus .Net core MVC app whose job is to display health stats using the healthcheck UI.
  The appsetting for this is:</p>
  <pre><code>{
    &quot;HealthChecks-UI&quot;: {
      &quot;HealthChecks&quot;: [
        {
          &quot;Name&quot;: &quot;TestApp API Health Check&quot;,
          &quot;Uri&quot;: &quot;https://localhost:7100/hc&quot;
        },
        {
          &quot;Name&quot;: &quot;TestApp API Health Check (Local)&quot;,
          &quot;Uri&quot;: &quot;https://localhost:7141/hc&quot;
        }
      ],
      &quot;Webhooks&quot;: [
        {
          &quot;Name&quot;: &quot;&quot;,
          &quot;Uri&quot;: &quot;&quot;,
          &quot;Payload&quot;: &quot;&quot;,
          &quot;RestoredPayload&quot;: &quot;&quot;
        }
      ],
      &quot;EvaluationTimeOnSeconds&quot;: 10,
      &quot;MinimumSecondsBetweenFailureNotifications&quot;: 60
    },
    &quot;Logging&quot;: {
      &quot;LogLevel&quot;: {
        &quot;Default&quot;: &quot;Information&quot;,
        &quot;Microsoft&quot;: &quot;Warning&quot;,
        &quot;Microsoft.Hosting.Lifetime&quot;: &quot;Information&quot;
      }
    },
    &quot;AllowedHosts&quot;: &quot;*&quot;
  }
  
  </code></pre>
  <p>And the docker compose file is as shown below</p>
  <pre><code>version: '3.4'
  
  services:
    testapp.api:
      environment:
        - ASPNETCORE_ENVIRONMENT=Development
        - ASPNETCORE_URLS=https://+:443;http://+:80
      ports:
        - &quot;8005:80&quot;
        - &quot;7100:443&quot;
      volumes:
        - ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro
        - ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro
  
    webstatus:
      environment:
        - ASPNETCORE_ENVIRONMENT=Development
        - ASPNETCORE_URLS=https://+:443;http://+:80
        - HealthChecksUI__HealthChecks__0__Name=Test App API Health Check
        - HealthChecksUI__HealthChecks__0__Uri=https://testapp.api/hc
      ports:
        - &quot;8006:80&quot;
        - &quot;7101:443&quot;
      depends_on:
        - testapp.api
      volumes:
        - ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro
        - ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro
  
  </code></pre>
  <p>If I start both the projects without docker, everything works, the WebStatus app shows the health status of the api as expected! However it doesn't work when I use docker compose to run this. The url I use to get to the webstatus app is https://localhost:7101/healthchecks-ui#/healthchecks</p>
  <p><a href="https://i.stack.imgur.com/FK6tK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FK6tK.png" alt="enter image description here" /></a></p>