[Breaking change]: Default ASP.NET Core port changed to 8080 in container images #35959
Closed
1 of 3 tasks
Labels
breaking-change
Indicates a .NET Core breaking change
doc-idea
Indicates issues that are suggestions for new topics [org][type][category]
Pri1
High priority, do before Pri2 and Pri3
📌 seQUESTered
Identifies that an issue has been imported into Quest.
Description
The default ASP.NET Core port configured in .NET container images has been updated from port 80 to 8080.
Coinciding with this change of the port is an update to use the new
ASPNETCORE_HTTP_PORTS
environment variable instead ofASPNETCORE_URLS
.Read more about this change at "Secure your .NET cloud apps with rootless Linux Containers".
Version
.NET 8 Preview 1
Previous behavior
Prior to .NET 8, you could run a container expecting port 80 to be the default port and be able to access the running app.
For example, running the following command would allow you to access the app locally at port 9999, which is mapped to port 80 in the container:
New behavior
Starting with .NET 8, if a user attempts to map to port 80 in the container without explicitly setting the ASP.NET Core port used in the container, any attempt made to connect to that mapped port will fail.
For example, if a user was to run the following command, they would be unable to connect to the application locally using port 9999.
Instead, the command, would need to be changed to use port 8080 within the container:
Type of breaking change
Reason for change
The change to the port number was made because of the need to provide a good usability experience when switching to a non-root user. Running as a non-root user requires the use of a non-privileged port in some environments. But port 80, the previous default port, is a privileged port. So the default is now updated to port 8080 which is a non-privileged port.
Recommended action
Users have two options to respond to this breaking change:
ASPNETCORE_HTTP_PORTS
/ASPNETCORE_HTTPS_PORTS
/ASPNETCORE_URLS
environment variable(s) to the desired port. Example:docker run --rm -it -p 9999:80 -e ASPNETCORE_HTTP_PORTS=80 <my-app>
docker run --rm -it -p 9999:8080 <my-app>
Feature area
Deployment
Affected APIs
No response
Associated WorkItem - 118218
The text was updated successfully, but these errors were encountered: