Docker build error inside corporate network

PS C:\TestAPIDocker\TestAPIDocker> docker build  -f Dockerfile . 
[+] Building 3.0s (12/17)
 => [internal] load build definition from Dockerfile                                                                                                                                0.0s
 => => transferring dockerfile: 736B                                                                                                                                                0.0s
 => [internal] load .dockerignore                                                                                                                                                   0.0s
 => => transferring context: 2B                                                                                                                                                     0.0s
 => [internal] load metadata for mcr.microsoft.com/dotnet/sdk:5.0                                                                                                                   0.2s
 => [internal] load metadata for mcr.microsoft.com/dotnet/aspnet:5.0                                                                                                                0.0s
 => [build 1/7] FROM mcr.microsoft.com/dotnet/sdk:5.0@sha256:081a6c31153f16c02eeb7f1ad663adb8e1d21fa0d59402348c13bba7659a5419                                                       0.0s
 => => resolve mcr.microsoft.com/dotnet/sdk:5.0@sha256:081a6c31153f16c02eeb7f1ad663adb8e1d21fa0d59402348c13bba7659a5419                                                             0.0s
 => [internal] load build context                                                                                                                                                   0.0s
 => => transferring context: 4.38kB                                                                                                                                                 0.0s
 => [base 1/2] FROM mcr.microsoft.com/dotnet/aspnet:5.0                                                                                                                             0.0s
 => CACHED [base 2/2] WORKDIR /app                                                                                                                                                  0.0s
 => CACHED [final 1/2] WORKDIR /app                                                                                                                                                 0.0s
 => CACHED [build 2/7] WORKDIR /src                                                                                                                                                 0.0s
 => CACHED [build 3/7] COPY [TestAPIDocker.csproj, TestAPIDocker/]                                                                                                                  0.0s
 => ERROR [build 4/7] RUN dotnet restore "TestAPIDocker/TestAPIDocker.csproj"                                                                                                       2.6s
------
 > [build 4/7] RUN dotnet restore "TestAPIDocker/TestAPIDocker.csproj":
#12 1.033   Determining projects to restore...
#12 2.567 /usr/share/dotnet/sdk/5.0.400/NuGet.targets(131,5): error : **Unable to load the service index for source https://api.nuget.org/v3/index.json.** [/src/TestAPIDocker/TestAPIDocker.csproj]
#12 2.567 /usr/share/dotnet/sdk/5.0.400/NuGet.targets(131,5): error :   **The SSL connection could not be established, see inner exception**. [/src/TestAPIDocker/TestAPIDocker.csproj]
#12 2.567 /usr/share/dotnet/sdk/5.0.400/NuGet.targets(131,5): error :   **The remote certificate is invalid because of errors in the certificate chain: PartialChain** [/src/TestAPIDocker/TestAPIDocker.csproj]
------
executor failed running [/bin/sh -c dotnet restore "TestAPIDocker/TestAPIDocker.csproj"]: exit code: 1
PS C:\TestAPIDocker\TestAPIDocker>

Need help on this error:
When we build image from public environment it is working good but when try to build image under corporate network it is giving the following error:

Determining projects to restore…
Unable to load the service index for source https://api.nuget.org/v3/index.json
The SSL connection could not be established, see inner exception
The remote certificate is invalid because of errors in the certificate chain: PartialChain

The below is my docker file:

#See Visual Studio Container Tools build and debug overview - Visual Studio (Windows) | Microsoft Docs to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:5.0 AS base
WORKDIR /app
EXPOSE 80

FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build
WORKDIR /src
COPY [“WebApplication1.csproj”, “.”]
RUN dotnet restore “./WebApplication1.csproj”
COPY . .
WORKDIR “/src/.”
RUN dotnet build “WebApplication1.csproj” -c Release -o /app/build

FROM build AS publish
RUN dotnet publish “WebApplication1.csproj” -c Release -o /app/publish

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT [“dotnet”, “WebApplication1.dll”]

Any one can proved the solution how to fix it. thanks in advance.

Do we have any answer for this?

The error indicates the network forces TLS inspection.

You should talk to your it-department and describe the problems you experience during Image builds because of TLS inspection.