I am a newbie to docker. How can we find which .net framework is installed in a docker image?

Viewed 313

I have copied .NET framework from my local directory and build an image by using the below Dockerfile

FROM mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2019

ADD setup C:\setup

RUN cmd.exe /c start /wait C:\setup\NDP471DevPack.exe /q

RUN powershell -Command rm C:\setup -r -Force

WORKDIR C:\\Project
ENTRYPOINT ["C:\\Program Files (x86)\\MSBuild\\14.0\\Bin\\msbuild.exe"]

Now I want verify that the .NET framework is whether installed or not in the image that was build?

2 Answers

You can run dotnet --version to see if there's a .NET runtime installed and which version it is. Something like this

docker run --rm --entrypoint=dotnet <image name> --version

You should be able to use:

reg query "HKLM\SOFTWARE\Microsoft\Net Framework Setup\NDP" /s

In Visual Studio I can select my container and click "Open Terminal Window" and paste the above command.

Related