如果我使用dotnet classlib -lang f# -o hello-docker创建一个新的控制台应用程序,cd进入目录,然后运行dotnet restore,一切都按预期工作。
但是,如果我添加了一个具有以下内容的Dockerfile
FROM microsoft/dotnet:2-sdk
WORKDIR /hello
COPY hello-docker.fsproj .
COPY *.fs ./
RUN dotnet restore
RUN dotnet build
ENTRYPOINT [ "dotnet", "run" ]如果运行docker build .,它将无法通过以下消息到达nuget.org:
/usr/share/dotnet/sdk/2.0.0/NuGet.targets(102,5):错误:无法加载源https://api.nuget.org/v3/index.json的服务索引。/hello/hello-docker.fsproj /usr/share/dotnet/sdk/2.0.0/NuGet.targets(102,5):错误:发送请求时发生错误。/hello/hello-docker.fsproj /usr/share/dotnet/sdk/2.0.0/NuGet.targets(102,5):错误:无法解析主机名/hello/hello-docker.fsproj 命令'/bin/sh -c dotnet还原‘返回了一个非零代码:1
为什么我可以在本地恢复,但不能在Docker容器中恢复?
发布于 2018-05-24 06:59:15
我通过在我的网络适配器上进入属性/共享来修复它,并将它与hyper/docker switch...think共享,它被称为nat或什么的。
https://stackoverflow.com/questions/46435320
复制相似问题