'NET 6 API not working when inside a docker container

I'm making a CRUD basic API with the .net 6 basic API template for a class project and it was working perfectly when using it locally, so I tried to dokcerize it since I want to try and upload it to the cloud, but even when giving the enviroment variables for the ASPNETCORE_URLS it won't allow me to connect properly once in the container.

When I have SSL installed it either gives me a connection refused or SSL error, and if I take SSL off it'll give me a 404 error.

I'm a student and I'm just starting with .NET so it might be a dumb error.

The app works as intended when in the container since I tried making a compose with it and it made the migration just fine, I just can't seem to be able to access it from the browser, curl or postman AppSettings.json

    {
  "ConnectionStrings": {
    "DefaultConnection": "server=localhost;user=root;password=;database=alumnos"
  },
  "https_port": 443,  
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning"
    }
  },
  "AllowedHosts": "*"
}

Dockerfile

#Build
FROM mcr.microsoft.com/dotnet/sdk:6.0-focal AS build
WORKDIR /source
COPY . .
RUN dotnet restore "./CRUDAPI_ASIR/CRUDAPI_ASIR.csproj" --disable-parallel
RUN dotnet publish "./CRUDAPI_ASIR/CRUDAPI_ASIR.csproj" -c release -o /app --no-restore

#Serve

FROM mcr.microsoft.com/dotnet/aspnet:6.0-focal
WORKDIR /app 
COPY --from=build /app ./

EXPOSE 80
EXPOSE 443

ENV server="mysql"
ENV user="root"
ENV password=""
ENV db="alumnos"

ENTRYPOINT ["dotnet", "CRUDAPI_ASIR.dll"]

Edit: Sorry about formatting errors, this is my first question and i'm kinda lost



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source