2017-08-29 112 views
2
Windows 10 version 1607 
Docker for Windows: Version 17.06.1-ce-win24 (13025) 

我試圖建立一個asp.net.net容器使用the provided docs和它不工作。我正在使用this provided dockerfile。我將它複製到我的一個asp.net解決方案的根目錄下。不能建立ASP.Net容器

而且我跑這個命令:

$ docker build -t aspnet-site --build-arg site_root=/ 

這是輸出

PS> docker build -t aspnet-site . --build-arg 'site_root=/' 
Sending build context to Docker daemon 326.1MB 
Step 1/6 : FROM microsoft/dotnet-framework:4.6.2 
4.6.2: Pulling from microsoft/dotnet-framework 
3889bb8d808b: Pull complete 
9f5eeabe6154: Pull complete 
Digest: sha256:c281f2c09c9446f1896806933013a350f19db8f5a009e633ebd9701c470de35b 
Status: Downloaded newer image for microsoft/dotnet-framework:4.6.2 
---> be84290c2315 
Step 2/6 : SHELL powershell -Command $ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; 
---> Running in 1fd036b1b56e 
---> 413164f1a97c 
Removing intermediate container 1fd036b1b56e 
Step 3/6 : RUN Add-WindowsFeature Web-Server;  Add-WindowsFeature NET-Framework-45-ASPNET;  Add-WindowsFeature Web-Asp-Net45;  Remove-Item -Recurse C:\inetpub\wwwroot\* 
---> Running in 4b0e5751281b 

Success Restart Needed Exit Code  Feature Result 
------- -------------- ---------  -------------- 
True No    Success  {Common HTTP Features, Default Documen... 
True No    Success  {ASP.NET 4.6} 
True No    Success  {Application Development, ASP.NET 4.6,... 


---> 9afab6bfa836 
Removing intermediate container 4b0e5751281b 
Step 4/6 : ADD ServiceMonitor.exe/
ADD failed: GetFileAttributesEx \\?\C:\WINDOWS\TEMP\docker-builder455754487\ServiceMonitor.exe: The system cannot find the file specified. 

所以它在文檔中(所以我嘗試註釋掉,則ServiceMonitor的東西,它的工作)說,這:

自從 microsoft/aspnet以來,沒有必要在Dockerfile中指定ENTRYPOINT基本映像已包含監視IIS萬維網發佈服務的狀態的入口點應用程序 (W3SVC)。

+1

你的docker文件是錯誤的,因爲它依賴於你沒有的build文件夾中的'ServiceMonitor.exe'。自己從頭開始製作完整的'DockerFile',不要依賴於樣本等,它們越來越快過時 –

回答

0

請嘗試使用此dockerfile代替。它將使用aspnet圖像:

FROM microsoft/aspnet 
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';"] 

EXPOSE 80 

RUN Remove-WebSite -Name 'Default Web Site' 
RUN New-Website -Name 'YourSiteName' -Port 80 -PhysicalPath 'C:\YourFolderName' -ApplicationPool '.NET v4.5' 

ADD "LocalFolderPath" /YourFolderName 
+0

微軟/ aspnet究竟是什麼? 4.6? 4.7?我需要4.6 – red888

+1

這是最新的,所以可能4.7。如果您願意,可以使用標記4.6.2:FROM microsoft/aspnet:4.6.2 – Guillaume