To workaround the issue, add the code ENV ASPNETCORE_URLS=http://+:80 below the other ENV declarations at the top of the Dockerfile.develop file
Dockerfile.develop after:
FROM mcr.microsoft.com/dotnet/core/sdk:3.1
ARG BUILD_CONFIGURATION=Debug
ENV ASPNETCORE_ENVIRONMENT=Development
ENV DOTNET_USE_POLLING_FILE_WATCHER=true
ENV ASPNETCORE_URLS=http://+:80
EXPOSE 80
Explanation
Server URLs is one of the ASP.NET Core Web Host configuration values. It uses the environment variable ASPNETCORE_URLS
and defaults to http://localhost:5000
:
Indicates the IP addresses or host addresses with ports and protocols that the server should listen on for requests.
Key: urls
Type: string
Default: http://localhost:5000
Set using: UseUrls
Environment variable: ASPNETCORE_URLS
See another thread for the meaning of http://+:80
: What’s the difference between http://*:80 and http://+:80
Update
As @Monsignor has pointed out:
The original issue is caused by an attempt to bind to localhost which AFAIK is not allowed from inside a docker container. But it’s perfectly fine to bind to 0.0.0.0, for example.