在Windows 10中构buildDocker时出错

我试图从一个非常简单的项目中构build一个docker镜像,只是为了开始了解docker如何工作和通信。 所以,我创build了一个WebApi项目,只有一个返回200的方法。

项目创build完成后,我创build了dockerfile:

# TP5 for technology preview (will not be needed when we go GA) # FROM microsoft/iis FROM microsoft/iis:TP5 MAINTAINER Roman_Hervas # Install Chocolatey (tools to automate commandline compiling) ENV chocolateyUseWindowsCompression='false' RUN @powershell -NoProfile -ExecutionPolicy unrestricted -Command "(iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))) >$null 2>&1" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin" # Install build tools RUN powershell add-windowsfeature web-asp-net45 \ && choco install microsoft-build-tools -y --allow-empty-checksums -version 14.0.23107.10 \ && choco install dotnet4.6-targetpack --allow-empty-checksums -y \ && choco install nuget.commandline --allow-empty-checksums -y \ && nuget install MSBuild.Microsoft.VisualStudio.Web.targets -Version 14.0.0.3 \ && nuget install WebConfigTransformRunner -Version 1.0.0.1 RUN powershell remove-item C:\inetpub\wwwroot\iisstart.* # Copy files (temporary work folder) RUN md c:\build WORKDIR c:/build COPY . c:/build # Restore packages, build, copy RUN nuget restore \ && "c:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" /p:Platform="Any CPU" /p:VisualStudioVersion=12.0 /p:VSToolsPath=c:\MSBuild.Microsoft.VisualStudio.Web.targets.14.0.0.3\tools\VSToolsPath WebApiDocker.sln \ && xcopy c:\build\WebApiDocker\* c:\inetpub\wwwroot /s # NOT NEEDED ANYMORE –> ENTRYPOINT powershell .\InitializeContainer 

和InitializeContainer:

 If (Test-Path Env:\ASPNET_ENVIRONMENT) { \WebConfigTransformRunner.1.0.0.1\Tools\WebConfigTransformRunner.exe \inetpub\wwwroot\Web.config "\inetpub\wwwroot\Web.$env:ASPNET_ENVIRONMENT.config" \inetpub\wwwroot\Web.config } # prevent container from exiting powershell 

所以,最后,我尝试执行命令来构build项目: docker build -t dockerexample。

结果是失败并显示以下消息(步骤4):

 Step 1/10 : FROM microsoft/iis:TP5 ---> accd044753c1 Step 2/10 : MAINTAINER Roman_Hervas ---> Using cache ---> e42af9c57e0d Step 3/10 : ENV chocolateyUseWindowsCompression 'false' ---> Using cache ---> 24621a9f18d9 Step 4/10 : RUN @powershell -NoProfile -ExecutionPolicy unrestricted -Command "(iex ((New-Object System.Net.WebClient).D ownloadString('https://chocolatey.org/install.ps1'))) >$null 2>&1" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin" ---> Running in 61199189917a container 61199189917a0057fb54dddca6d80a6c6f9e8b77d2326379537684f58fefbe50 encountered an error during CreateContainer: failure in a Windows system call: A connection could not be established with the Virtual Machine hosting the Container. (0xc0370108) extra info: {"SystemType":"Container","Name":"61199189917a0057fb54dddca6d80a6c6f9e8b77d2326379537684f58fefb e50","Owner":"docker","IsDummy":false,"IgnoreFlushesDuringBoot":true,"LayerFolderPath":"C:\\ProgramData\\Docker\\windows filter\\61199189917a0057fb54dddca6d80a6c6f9e8b77d2326379537684f58fefbe50","Layers":[{"ID":"08b847bd-7f7e-5758-90be-43262 e170e22","Path":"C:\\ProgramData\\Docker\\windowsfilter\\64e43de6efd9eee001b12f6ed8add83d1aefff6cb5f8b55e9a44c4b1b2f27b8 0"},{"ID":"293472e6-599f-5a8e-b531-ac7499b0c900","Path":"C:\\ProgramData\\Docker\\windowsfilter\\cfb71fcbe2f95caa2a5306d 800c3d649067c00702a26a208ead6f5fed58e49c8"},{"ID":"baacc247-5374-5761-812f-e1ad911fda31","Path":"C:\\ProgramData\\Docker \\windowsfilter\\89144a071d22e130e0ca9a069857a181b8976e9557c95395fb58116358dd5a02"},{"ID":"3d538ae4-eaf0-574c-b274-30bba ce1a9b0","Path":"C:\\ProgramData\\Docker\\windowsfilter\\e2ff3bea019eaee94ab33312b6a39d6305b85df9b0b950680aa38e55eec5437 1"},{"ID":"937e8340-c320-5f09-a87e-9cd5912f40bb","Path":"C:\\ProgramData\\Docker\\windowsfilter\\0dd23a484fe7eea9da274be 8e6e1f0768b52a8a121e7bf274d5974ada02400d8"}],"HostName":"2ac70997c0f2","MappedDirectories":[],"SandboxPath":"C:\\Program Data\\Docker\\windowsfilter","HvPartition":true,"EndpointList":["deb85df1-5dba-4394-a1ac-77f4a106e31a"],"HvRuntime":{"Im agePath":"C:\\ProgramData\\Docker\\windowsfilter\\0dd23a484fe7eea9da274be8e6e1f0768b52a8a121e7bf274d5974ada02400d8\\Util ityVM"},"Servicing":false,"AllowUnqualifiedDNSQuery":true} 

我完全不知道Docker,所以我不知道这个问题,Google也没有太大的帮助。 我的操作系统是Windows 10 Pro,而Docker版本是17.03.1-ce-win12(12058)。

问题:为什么在步骤4中启动错误?

非常感谢你提前。