I'm using .net 8 and Docker Desktop with linux container.
I'm making a request from API in docker to another api and it's not working and if i'm a call to external api with domain for example https://somedomian/api - it's working find.
I have this error (localhost to localhost with HttpClient in Docker container):
The request was canceled due to the configured HttpClient.Timeout of 30 seconds elapsing
Docker file:
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.
FROM comp-artifactory.bb.comp.gov.com/docker/dotnet/aspnet:8.0 AS base
USER app
WORKDIR /app
EXPOSE 80
EXPOSE 443
#RUN dotnet dev-certs https --trust
FROM comp-artifactory.bb.comp.gov.com/docker/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["netTestAApi/netTestAApi.csproj", "netTestAApi/"]
RUN dotnet nuget add source http://comp-artifactory.bb.comp.gov.com:8082/artifactory/api/nuget/v3/nuget -n artifactory
RUN dotnet nuget disable source nuget.org
RUN dotnet restore "./netTestAApi/./netTestAApi.csproj"
COPY . .
WORKDIR "/src/netTestAApi"
RUN dotnet build "./netTestAApi.csproj" -c $BUILD_CONFIGURATION -o /app/build
FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./netTestAApi.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false
COPY ./netTestAApi/crt/1.crt /usr/local/share/ca-certificates
COPY ./netTestAApi/crt/2.crt /usr/local/share/ca-certificates
RUN update-ca-certificates
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
COPY --from=build-env /app/out/netTestAApi.SwaggerExtensions.xml ./
ENTRYPOINT ["dotnet", "netTestAApi.dll"]
Thanks a lot for your help.