处理“HTTP请求超时。 退出“。为Docker构build一个大型的aspnet项目

我有一个使用MVC6的多项目aspnet解决scheme

解决scheme文件分为三个项目

sln +---- Model +---- API +---- Web 

Docker文件与SLN文件位于同一文件夹中,并具有以下内容

  FROM microsoft/aspnet COPY . /app WORKDIR /app/Web RUN ["dnu", "restore"] EXPOSE 5004 ENTRYPOINT ["dnx", ".", "kestrel" ] 

当我运行docker build -t myapp . 从powershell命令行是build立过程开始超时。

 PS C:\www\MyApp> docker build -t myapp . Sending build context to Docker daemon 19.11 MB Step 0 : FROM microsoft/aspnet ---> 0835b01cd4f8 Step 1 : COPY . /app ---> Using cache ---> 56c449a3d847 Step 2 : WORKDIR /app/Web ---> Using cache ---> 8f43b8786452 Step 3 : RUN dnu restore ---> Running in d43e0c4b42c8 Microsoft .NET Development Utility Mono-x64-1.0.0-beta7-15532 GET https://api.nuget.org/v3/index.json OK https://api.nuget.org/v3/index.json 555ms Restoring packages for /app/Web/project.json GET https://az320820.vo.msecnd.net/v3-flatcontainer/microsoft.aspnet.diagnostics/index.json GET https://az320820.vo.msecnd.net/v3-flatcontainer/microsoft.aspnet.mvc/index.json GET https://az320820.vo.msecnd.net/v3-flatcontainer/microsoft.aspnet.mvc.taghelpers/index.json GET https://az320820.vo.msecnd.net/v3-flatcontainer/microsoft.aspnet.server.iis/index.json GET https://az320820.vo.msecnd.net/v3-flatcontainer/microsoft.aspnet.server.weblistener/index.json GET https://az320820.vo.msecnd.net/v3-flatcontainer/microsoft.aspnet.staticfiles/index.json GET https://az320820.vo.msecnd.net/v3-flatcontainer/microsoft.aspnet.tooling.razor/index.json GET https://az320820.vo.msecnd.net/v3-flatcontainer/microsoft.framework.configuration.json/index.json GET https://az320820.vo.msecnd.net/v3-flatcontainer/microsoft.framework.logging/index.json GET https://az320820.vo.msecnd.net/v3-flatcontainer/microsoft.framework.logging.console/index.json GET https://az320820.vo.msecnd.net/v3-flatcontainer/microsoft.visualstudio.web.browserlink.loader/index.json OK https://az320820.vo.msecnd.net/v3-flatcontainer/microsoft.aspnet.diagnostics/index.json 6436ms 

[…成功的几百条…]灾难来袭!

 GET https://az320820.vo.msecnd.net/v3-flatcontainer/microsoft.win32.registry/4.0.0-beta-23109/microsoft.win32.registry.4.0.0-beta-23109.nupkg Warning: FindPackagesById: Microsoft.Framework.Runtime.Roslyn.Common HTTP request timed out. Retrying. GET https://az320820.vo.msecnd.net/v3-flatcontainer/system.io.filesystem/index.json Warning: FindPackagesById: Microsoft.Framework.Runtime.Roslyn.Abstractions HTTP request timed out. Retrying. GET https://az320820.vo.msecnd.net/v3-flatcontainer/system.resources.resourcemanager/index.json Warning: FindPackagesById: System.Threading.Tasks.Parallel HTTP request timed out. Retrying. GET https://az320820.vo.msecnd.net/v3-flatcontainer/system.diagnostics.debug/index.json Warning: FindPackagesById: Microsoft.AspNet.Antiforgery HTTP request timed out. Retrying. 

[…造成了很多…]

 GET https://az320820.vo.msecnd.net/v3-flatcontainer/microsoft.win32.primitives/index.json Error: DownloadPackageAsync: https://az320820.vo.msecnd.net/v3-flatcontainer/microsoft.aspnet.http.abstractions/1.0.0-beta6/microsoft.aspnet.http.abstractions.1.0.0-beta6.nupkg HTTP request timed out. Exiting. ---------- System.Threading.Tasks.TaskCanceledException: A task was canceled. at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00000] in <filename unknown>:0 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00000] in <filename unknown>:0 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00000] in <filename unknown>:0 at System.Runtime.CompilerServices.TaskAwaiter`1[System.Net.Http.HttpResponseMessage].GetResult () [0x00000] in <filename unknown>:0 at System.Net.Http.HttpClientHandler+<SendAsync>c__async0.MoveNext () [0x00000] in <filename unknown>:0 --- End of stack trace from previous location where exception was thrown --- 

[…和事件…]

 ---------- Restore failed A task was canceled. NuGet Config files used: /root/.config/NuGet/NuGet.Config Feeds used: https://az320820.vo.msecnd.net/v3-flatcontainer/ GET https://az320820.vo.msecnd.net/v3-flatcontainer/system.security.cryptography.x509certificates/index.json SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories. The command 'dnu restore' returned a non-zero code: 1 

我尝试过寻找这方面的答案,然后做一些事情,比如重新启动Docker机器或者删除并重build(以kitematic),但即使这些解决schemeDID工作(他们不这样做),解决scheme似乎也不太理想。

请注意,我也试图从超时的同一台机器上查看正在超时的URL,并且他们在Windows中工作。

我认为这可能意味着virtualbox docker机器可能会超时,使其可以打开的连接数量达到饱和

docker镜像是Docker工具箱附带的默认boot2docker linux实例。

它在Windows 10上运行。

另外,如果我在一个新的aspnet项目上运行相同的设置和命令(使用yo aspnet生成器创build),docker确实成功地构build了项目。

在搞清楚如何构builddocker图像的任何帮助将非常赞赏。