1

我在 Docker 容器中执行 dotnet restore 时收到以下错误消息:

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”因“SSL 对等证书或 SSH 远程密钥不正常”而失败

任何想法?

问候, 克里斯蒂安

4

1 回答 1

1

使用更新版本的 dotnet sdk 时,我不再收到错误消息。

FROM microsoft/dotnet:2.0.0-sdk
于 2017-11-28T08:15:29.317 回答