Tom*_*han 6 docker windows-10 .net-core
如果我使用创建一个新的控制台应用程序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" ]
Run Code Online (Sandbox Code Playgroud)
并运行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 restore”返回非零代码:1
为什么我可以在本地还原,但不能在Docker容器内部还原?
我通过进入我的网络适配器上的属性/共享来修复它并与 hyper-v/docker 开关共享它......认为它被称为 nat 或其他东西。
| 归档时间: |
|
| 查看次数: |
2076 次 |
| 最近记录: |