在运行docker-compose构建时,在dotnet恢复上出现以下错误。
C:\Program Files\dotnet\sdk\2.1.802\NuGet.targets(123,5): error : Unable to load the service index for source https://api.nuget.org/v3/index.json. [C:\src\<ProjectName>\ProjectName.csproj]
找到docker-compose文件
version: '3.4'
services:
projectname.api:
image: ${DOCKER_REGISTRY-}projectname
build:
context: .
dockerfile: projectname\Dockerfile
找到DockerFile
FROM mcr.microsoft.com/dotnet/core/aspnet:2.1 AS base
WORKDIR /app
EXPOSE 52000:80
FROM mcr.microsoft.com/dotnet/core/sdk:2.1 AS build
WORKDIR /src
COPY ["<ProjectName>.API/<ProjectName>.API.csproj", "<ProjectName>.API/"]
COPY ["<ProjectName>.Core/<ProjectName>.Core.csproj", "<ProjectName>.Core/"]
COPY ["<ProjectName>.NetCore/<ProjectName>.NetCore.csproj", "<ProjectName>.NetCore/"]
COPY ["<ProjectName>.Repository/<ProjectName>.Repository.csproj", "<ProjectName>.Repository/"]
COPY ["<ProjectName>.Service/<ProjectName>.Service.csproj", "<ProjectName>.Service/"]
RUN dotnet restore "<ProjectName>.API/<ProjectName>.API.csproj"
COPY . .
WORKDIR "/src/<ProjectName>.API"
RUN dotnet build "<ProjectName>.API.csproj" -c Release -o /app/build
FROM build AS publish
RUN dotnet publish "<ProjectName>.API.csproj" -c Release -o /app/publish
FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "<ProjectName>.API.dll"]
我在哪里做错了?建议将不胜感激。