title: ASP.NET Core Docker Container App not accessible
body: <p>I run an ASP.NET Core service in a Docker container on MacOS.<br>
  Visual Studio for Mac v18.1.2 (build 2)
  .NET Core SDK: 2.2.300</p>
  
  <p>Here is the Dockerfile:</p>
  
  <pre><code>FROM mcr.microsoft.com/dotnet/core/aspnet:2.2 AS base
  WORKDIR /app
  EXPOSE 80
  EXPOSE 443
  
  FROM mcr.microsoft.com/dotnet/core/sdk:2.2 AS build
  WORKDIR /
  COPY src/Services/Service.API/Service.API.csproj src/Services/Service.API/
  RUN dotnet restore src/Services/Service.API/Service.API.csproj
  COPY . .
  WORKDIR /src/Services/Service.API
  RUN dotnet build Service.API.csproj -c Release -o /app
  
  FROM build AS publish
  RUN dotnet publish Service.API.csproj -c Release -o /app
  
  FROM base AS final
  WORKDIR /app
  COPY --from=publish /app .
  ENTRYPOINT ["dotnet", "Service.API.dll"]
  </code></pre>
  
  <p>Here is how the docker-compose file for the service looks like:</p>
  
  <pre><code>service.api:
    build:
      context: .
      dockerfile: src/Services/Service.API/Dockerfile
    environment:
      - ASPNETCORE_ENVIRONMENT=Development
      - ASPNETCORE_URLS=http://+:80;https://+:443
      - ASPNETCORE_HTTPS_PORT=5254 
      - ASPNETCORE_Kestrel__Certificates__Default__Password=crypticpassword
      - ASPNETCORE_Kestrel__Certificates__Default__Path=/https/aspnetapp.pfx
    ports:
      - "5204:80"
      - "5254:443"
    volumes:
      - ${HOME}/.aspnet/https:/https/
  </code></pre>
  
  <p>The ports of the running Docker container looks good too:</p>
  
  <blockquote>
    <p>0.0.0.0:5204->80/tcp, 0.0.0.0:5254->443/tcp    </p>
  </blockquote>
  
  <p>But when I try to call <a href="https://localhost:5254" rel="nofollow noreferrer">https://localhost:5254</a> it says site cannot be reached.</p>
  
  <p>Also in the output I see following warning:</p>
  
  <blockquote>
    <p>warn: Microsoft.AspNetCore.Server.Kestrel[0]
          Unable to bind to <a href="https://localhost:5001" rel="nofollow noreferrer">https://localhost:5001</a> on the IPv6 loopback interface: 'Cannot assign requested address'.
    Microsoft.AspNetCore.Server.Kestrel:Warning: Unable to bind to
    <a href="https://localhost:5001" rel="nofollow noreferrer">https://localhost:5001</a> on the IPv6 loopback interface: 'Cannot assign
    requested address'. Hosting environment: Development Content root
    path: /app Now listening on: <a href="https://localhost:5001" rel="nofollow noreferrer">https://localhost:5001</a></p>
  </blockquote>
  
  <p>Why doesn't it take the urls set by the ASPNETCORE_URLS enivronment variable?</p>
  
  <p>What else could I do for troubleshooting to find the problem?</p>