我正在尝试构建一个asp.net代码应用程序的docker容器,尝试检索nuget包时遇到错误


  docker build -t my:container。


Sending build context to Docker daemon  9.58 MB
Step 1 : FROM microsoft/dotnet:latest
 ---> 3693707d4f7f
Step 2 : COPY . /app
 ---> Using cache
 ---> 22a461236738
Step 3 : WORKDIR /app
 ---> Using cache
 ---> 8bea2af489ad
Step 4 : RUN dotnet restore
 ---> Running in 5fbfe078c820
log  : Restoring packages for /app/project.json...
error: Unable to load the service index for source https://api.nuget.org/v3/index.json.
error:   An error occurred while sending the request.
error:   Peer certificate cannot be authenticated with given CA certificates
The command 'dotnet restore' returned a non-zero code: 1


我正在使用的dockerfile是一个非常标准的文件,它基于microsoft / dotnet:latest容器。

FROM microsoft/dotnet:latest
COPY . /app
WORKDIR /app

RUN ["dotnet", "restore"]
RUN ["dotnet", "build"]

EXPOSE 9881/tcp
ENV ASPNETCORE_URLS http://*:9881

ENTRYPOINT ["dotnet", "run"]


这曾经工作了一段时间,似乎已经坏了,但我不知道那会是什么。

最佳答案

问题是我一直在使用docker的实验版本1.12.3。

现在,我在Windows上安装了最新的正式版本(仍然是1.12.3,但未标记为实验性的),因此一切正常。

07-24 09:45
查看更多