NET 6 Dockerfile Timeout Error

Hi, i’m running a very basic net 6 Docker app. This is the Dockerfile

FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base

RUN apt-get update && apt-get install -y apt-utils libgdiplus libc6-dev

WORKDIR /app

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build

WORKDIR /src

COPY ["myapp/myapp.csproj", "myapp/"]

RUN dotnet restore "myapp/myapp.csproj"

COPY . .

WORKDIR "/src/myapp"

RUN dotnet build "myapp.csproj" -c Release -o /app/build

FROM build AS publish

RUN dotnet publish "myapp.csproj" -c Release -o /app/publish

FROM base AS final

WORKDIR /app

COPY --from=publish /app/publish .

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

The logs show the app building and running properly
image

And there’s an env variable PORT set up matching the app port of the kestrel server
image

However, the deploy eventually fails with a timed out error and accessing the app URL returns a 502 response.

Any ideas? Thanks.

Hi Marcos,

Thanks for reaching out.

There seems to be a function ListenLocalhost in your screenshot. You’d need to be listening on all interfaces (0.0.0.0) and not localhost (127.0.0.1). Maybe that’s the issue?

Alan

Okay, expanding the webhost config with a wildcard made it work. Thanks for pointing me in the right direction!

For anyone facing the same issue:
image

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.