EXPOSE documents the container port on which an application listens; it does not publish that port to the host. In a published .NET application, port 80 is exposed because the default HTTP port is 80 inside the container. section 13.3.1
Exposing a published ASP.NET Core application
A multistage Dockerfile uses an SDK image to publish the application, copies the output into an ASP.NET runtime image, and declares `EXPOSE 80` before starting `AsciiArtSvc.dll`. A development Dockerfile can instead declare `EXPOSE 5101` when using the Docker launch profile. section 13.3.1
Listing 13.6 Dockerfile with two build stages
FROM mcr.microsoft.com/dotnet/sdk:6.0 #1 COPY . /src WORKDIR /src RUN dotnet publish -o /publish #2 FROM mcr.microsoft.com/dotnet/aspnet:6.0 #3 COPY --from=0 /publish /publish #4 WORKDIR /publish EXPOSE 80 #5 ENTRYPOINT ["dotnet", "AsciiArtSvc.dll"] #6
Inspect the complete multistage Dockerfile showing EXPOSE alongside the runtime image and application entry point. section 13.3.1

