“dotnet restore”失败,“SSL对等证书或SSH远程密钥不正常”

时间:2017-05-03 12:06:17

标签: docker .net-core dotnet-restore

我在Docker容器中进行dotnet还原时遇到以下错误:

christian@debian:~/workspace$ docker build -t projectimage:v2 .
Sending build context to Docker daemon 4.336 MB
Step 1/9 : FROM microsoft/dotnet:1.1.1-sdk
 ---> 6aa7ef4f1f91
Step 2/9 : ADD https://adeartifactory/artifactory/tools/certificates/ca-bundle.crt /usr/local/share/ca-certificates/
Downloading  4.92 kB/4.92 kB
 ---> Using cache
 ---> 16d949cfeb21
Step 3/9 : RUN update-ca-certificates
 ---> Using cache
 ---> b86a8b2407e6
Step 4/9 : RUN mkdir /app
 ---> Using cache
 ---> c34785f331f0
Step 5/9 : COPY . /app
 ---> 93f3fd145ba2
Removing intermediate container 67f454eea5b7
Step 6/9 : WORKDIR /app
 ---> fe3cc459c87e
Removing intermediate container d0f14b824830
Step 7/9 : RUN dotnet restore . --source https://adeartifactory/artifactory/api/nuget/nuget-all
 ---> Running in 111d2a75d82d
  Restoring packages for /app/Api.csproj...
  Retrying 'FindPackagesByIdAsyncCore' for source 'https://adeartifactory/artifactory/api/nuget/nuget-all/FindPackagesById()?id='Microsoft.ApplicationInsights.AspNetCore''.
  An error occurred while sending the request.
    SSL peer certificate or SSH remote key was not OK
  Retrying 'FindPackagesByIdAsyncCore' for source 'https://adeartifactory/artifactory/api/nuget/nuget-all/FindPackagesById()?id='Swashbuckle''.
  An error occurred while sending the request.
    SSL peer certificate or SSH remote key was not OK
  Retrying 'FindPackagesByIdAsyncCore' for source 'https://adeartifactory/artifactory/api/nuget/nuget-all/FindPackagesById()?id='Microsoft.ApplicationInsights.AspNetCore''.
  An error occurred while sending the request.
    SSL peer certificate or SSH remote key was not OK
  Retrying 'FindPackagesByIdAsyncCore' for source 'https://adeartifactory/artifactory/api/nuget/nuget-all/FindPackagesById()?id='Swashbuckle''.
  An error occurred while sending the request.
    SSL peer certificate or SSH remote key was not OK
/usr/share/dotnet/sdk/1.0.1/NuGet.targets(97,5): error : Failed to retrieve information about 'Microsoft.ApplicationInsights.AspNetCore' from remote source 'https://adeartifactory/artifactory/api/nuget/nuget-all/FindPackagesById()?id='Microsoft.ApplicationInsights.AspNetCore''. [/app/Api.sln]
/usr/share/dotnet/sdk/1.0.1/NuGet.targets(97,5): error :   An error occurred while sending the request. [/app/Api.sln]
/usr/share/dotnet/sdk/1.0.1/NuGet.targets(97,5): error :   SSL peer certificate or SSH remote key was not OK [/app/Api.sln]
The command '/bin/sh -c dotnet restore . --source https://adeartifactory/artifactory/api/nuget/nuget-all' returned a non-zero code: 1

Dockerfile:

FROM microsoft/dotnet:1.1.1-sdk

ADD https://adeartifactory/artifactory/tools/certificates/ca-bundle.crt /usr/local/share/ca-certificates/

RUN update-ca-certificates

RUN mkdir /app
COPY . /app

WORKDIR /app

RUN dotnet restore . --source https://adeartifactory/artifactory/api/nuget/nuget-all
RUN dotnet publish -c Release -o out

ENTRYPOINT ["dotnet", "out/Api.dll"]

这似乎是相同的,但没有解决问题:

"dotnet restore" fails with "SSL peer certificate or SSH remote key was not OK"

有什么想法吗?

此致 基督教

1 个答案:

答案 0 :(得分:1)

我不再使用更新版本的dotnet sdk获取错误消息。

FROM microsoft/dotnet:2.0.0-sdk