I'm new to docker and I'm trying to run a simple ASP.NET Core 6 application on a docker container on Ubuntu, but, I'm getting the HTTP ERROR 404 error when I try to access the appication via Google Chrome.
This is my Dockerfile:
# syntax=docker/dockerfile:1
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env
WORKDIR /app
EXPOSE 5000
ENV ASPNETCORE_URLS=http://+:5000
# Copy csproj and restore as distinct layers
COPY *.csproj ./
RUN dotnet restore
# Copy everything else and build
COPY ./ ./
RUN dotnet publish -c Release -o out
# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:6.0
WORKDIR /app
COPY --from=build-env /app/out .
ENTRYPOINT ["dotnet", "TesteDocker.dll"]
I have disabled the HTTPS redirection on Program.cs
I'm using this commands to build the image and run the container:
docker build -t testedocker .
docker run -d -p 5000:5000 --name testedocker_container testedocker
And trying to access the app URL in this way: http://localhost:5000/swagger
What I'm doing wrong?