I am struggling to install .NET Framework 3.5 on docker container. I have 4.5 installed already, but need 3.5 to run one Service. Here is my Dockerfile:
FROM microsoft/windowsservercore
SHELL ["powershell"]
RUN Install-WindowsFeature NET-Framework-45-ASPNET ; \
Install-WindowsFeature Web-Asp-Net45
RUN dism /online /enable-feature /featurename:NetFX3 /all
COPY Startup Startup
COPY Service Service
RUN "C:\Windows\Microsoft.NET\Framework\v4.0.30319\installutil.exe" WCS.WindowsService.exe
RUN mkdir Temp\Logs
ENTRYPOINT C:\Startup\setupBatch.bat
COPY ContainerApi ContainerApi
RUN Remove-WebSite -Name 'Default Web Site'
RUN New-Website -Name 'ContainerApi' -Port 80 \
-PhysicalPath 'C:\ContainerApi' -ApplicationPool '.NET v4.5'
EXPOSE 80
CMD ["ping", "-t", "localhost"]
When I try to build this, it gives me error on line RUN dism
Error: 0x800f081f
The source files could not be found.
Use the "Source" option to specify the location of the files that are required to restore the feature. For more information on specifying a source location, see http://go.microsoft.com/fwlink/?LinkId=243077.
Now, even if I run dism /online /enable-feature /featurename:NetFX3 /all
inside the docker (docker exec) it will still give me the same error.
Anyone with any help?
For those who are still are in need of .Net3.5 and .Net4.X (4.7.2 for my case) version in one image.
Please note that MSFT is aware of this demand, and have a base image for this scenario.
Use FROM mcr.microsoft.com/dotnet/framework/sdk:3.5-20191008-windowsservercore-ltsc2019
in your dockerfile.
Saved me all the installation hassles.
I took the following steps to resolve this issue:
Used the Install-WindowsFeature powershell command to install the feature.
Install-WindowsFeature -Name NET-Framework-Features -Source C:\sources\sxs -Verbose
Hope this helps. I also found the following blog useful in understanding the on-demand features. https://blogs.technet.microsoft.com/askcore/2012/05/14/windows-8-and-net-framework-3-5/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With