Can't build ASP.Net container

506 views Asked by At
Windows 10 version 1607
Docker for Windows: Version 17.06.1-ce-win24 (13025)

I'm trying to build a asp .net 4.6 container using the provided docs and its not working.

I'm using this provided dockerfile. I copied it to the root of one of my asp .net solutions.

And the I ran this command:

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

This is the output

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.

So it does say this in the docs (so I tried commenting out the servicemonitor stuff and it worked):

There is no need to specify an ENTRYPOINT in your Dockerfile since the microsoft/aspnet base image already includes an entrypoint application that monitors the status of the IIS World Wide Web Publishing Service (W3SVC).

1

There are 1 answers

2
Guillaume On

Try with this dockerfile instead. It will use the aspnet image:

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