Home > Net >  linux docker restore stuck
linux docker restore stuck

Time:10-02

i have some pipelines in azure devops 2020 that were ok but now suddenly doesnt work. i found that docker cant restore and stuck. i clone my project in docker server and check with docker build command. i get errors like azure devops log.

environment: os: rocky linux 8.6 docker 20.10.18

errors: Build FAILED

           "/src/RLData_API/RLData_API.csproj" (Restore target) (1) ->
           (Restore target) ->
             /src/RLData_API/RLData_API.csproj : error NU1301: Unable to load the service index for source http://api.nuget.org/v3/index.json.
             /src/RLData_API/RLData_API.csproj : error NU1301: Unable to load the service index for source http://api.nuget.org/v3/index.json.

Dockerfile:

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

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
WORKDIR /src
COPY ["RLData_API/RLData_API.csproj", "RLData_API/"]
COPY ["RLData_API/nuget.config", ""]
#RUN dotnet restore "RLData_API/RLData_API.csproj"
RUN dotnet restore -v diag  "RLData_API/RLData_API.csproj" --configfile nuget.config
COPY . .
WORKDIR "/src/RLData_API"
RUN dotnet build "RLData_API.csproj" -c Release -o /app/build

FROM build AS publish
RUN dotnet publish "RLData_API.csproj" -c Release -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "RLData_API.dll"]

nuget.config:

<?xml version="1.0" encoding="utf-8"?>
    <configuration>
        <packageSources>
            <add key="Feed" value="http://dev.to.com/Iro/IQ/_packaging/Feed/nuget/v3/index.json" />
            <add key="nuget.org" value="http://api.nuget.org/v3/index.json" protocolVersion="3" />
        </packageSources>
        <activePackageSource>
                <add key="All" value="(Aggregate source)" />
            </activePackageSource>
          <packageSourceCredentials>
            <Feed>
                <add key="Username" value="iro" />
                <add key="ClearTextPassword" value="my PAT Token" />
                    <add key="ValidAuthenticationTypes" value="basic" />
            </Feed>
          </packageSourceCredentials>
    </configuration>

CodePudding user response:

problem solved :) replace sdk:6.0 with sdk:6.0-alpine

  • Related