Closed jontreynes closed 7 years ago
Some more info. My vm had aspnet 3.5 and 4.5 installed which probably isn't best practice. The asp.net Application I wanted to extract required 4.5. However, the ConvertToDockerfile prepped this as the base image FROM microsoft/aspnet:3.5-windowsservercore-10.0.14393.1066 and did not consider 4.5
Thanks for that - can you try running your ConvertToDockerfile
command with an -ArtifactParam
argument, so it only extracts the .NET 4.5 web app you're interested in? The IIS docs have examples for that.
On the wider issue, the fix for this isn't very nice. If you have 3.5 in the source then we need to use aspnet:3.5
as the base image, because you can't install 3.5 with any of the standard Windows Server images. So then we'd need to start from aspnet:3.5
and install 4.5 on top. Possible, but not a great result.
Hey! Thanks for a speedy reply @sixeyed . I did run -ArtifactParam IIS. And yes... that does make sense. I guess image2docker is not smart enough to tell which IIS web app is running 3.5 and which is running 4.5. Would be a nice feature to have...but not sure if there's many use cases for this yet. Something like ConvertTo-Dockerfile -imagepath blahblah -outputpath blahblahblah -artifact IIS -artifactParam webapp -ArtifactDependsOn asp.net-4.5 would be nice.
Some manual editing got this to run as smooth as Steve Harvey's head
FROM microsoft/aspnet:3.5-windowsservercore-10.0.14393.1066
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
RUN Set-ItemProperty -path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name ServerPriorityTimeLimit -Value 0 -Type DWord
RUN Remove-Website 'Default Web Site';
RUN Add-WindowsFeature Web-server, Net-Framework-45-ASPNET, Web-Asp-Net45 ########################################################
RUN New-Item -Path 'C:\inetpub\wwwroot\mywebapp' -Type Directory -Force;
RUN New-Website -Name 'mywebapp' -PhysicalPath 'C:\inetpub\wwwroot\mywebapp' -Port 8080 -Force;
EXPOSE 8080
COPY ["mywebapp", "/inetpub/wwwroot/mywebapp"]
or you could do this... replace the base image with microsoft/aspnet:windowsservercore-10.0.14393.1066 and leave it all the same :)
Hope this helps anyone!
I'm going to close this. @sixeyed would it make sense to search for versions in reverse order? That way we'd always match the latest version instead of the oldest version.
ConvertTo-Dockerfile is creating an insufficient Dockerfile for me from my windows server 2016 vhdx. When I try extracting an ASP.net app hosted in IIS, it does not supply the standard line "RUN Add-WindowsFeature Web-server, Net-Framework-45-ASPNET, Web-Asp-Net45"
Side note: Also, my "RUN Enable-WindowsOptionalFeature -Online -FeatureName IIS-ApplicationDevelopment,IIS-ApplicationInit,..." is receiving an error message saying,"Enable-WindowsOptionalFeature : One or several parent features are disabled so current feature can not be enabled."
Is my vhdx not reaching a certain requirement?