I am new to Docker. I have installed DockerDesktop. I am trying to expose an ASP.NET Core Web API via docker containers.
This is my docker file:
# This stage is used to build the service project
FROM *****/dotnet-80-sdk-runtime:latest AS builder #local artificatory within my company
ARG BUILD_CONFIGURATION=Release
WORKDIR /build
USER root
COPY ./NuGet.Config ./NuGet.Config
COPY . .
RUN ls -la
RUN dotnet restore "./GrafProm.API.csproj" --configfile ./NuGet.Config
RUN dotnet build "./GrafProm.API.csproj" -c Release --no-restore -o /app/buildOutput
RUN dotnet publish "./GrafProm.API.csproj" -c Release --no-restore -o /app/publish
FROM *****/dotnet-80-runtime:latest AS run
EXPOSE 8080
ENV ASPNETCORE_URLS=http://+:8080
ENV DOTNET_ROOT=/usr/mware/dotnet
ENV ASPNETCORE_ENVIRONMENT=development
USER root
RUN mkdir -p /var/log/containers
#
WORKDIR /app
COPY --from=builder /app/publish .
ENTRYPOINT ["dotnet", "GrafProm.API.dll"]
I am using VS 2022 and this is my launchsettings.json file:
"profiles": {
"http": {
"commandName": "Project",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": true,
"applicationUrl": "http://localhost:5293"
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Container (Dockerfile)": {
"commandName": "Docker",
"launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger",
"environmentVariables": {
"ASPNETCORE_HTTP_PORTS": "8080"
},
"publishAllPorts": true,
"useSSL": false
}
When I run the container (Dockerfile) in VS, the image and container are getting created, but I get this error:
Instead of getting swagger page, I am getting an error page in IE.
Can someone help?
Thanks in advance.

FROM *****/dotnet-80-sdk-runtime:latest AS builder #local artificatory within my company. I mean we can test it to verify the issue is related to image or not.