What happens when we build a Docker image?

82 Views Asked by At

Suppose I have the .NET Framework 4.8 SDK and runtime installed on my local machine. I have a dockerfile having the base image instruction FROM mcr.microsoft.com/dotnet/framework/sdk:4.8. When I build the image, would it install the .NET Framework 4.8 SDK and runtime as layers or create layer from the already installed .NET Framework 4.8 SDK and runtime present on my machine?

1

There are 1 best solutions below

0
On BEST ANSWER

When you define FROM mcr.microsoft.com/dotnet/framework/sdk:4.8 It will Only Contain the SDK and .Net Frameworks of version 4.8.

It won't reuse or create a layer from the .NET Framework SDK and runtime installed on your local machine. The reason is docker containers and Images are wholly isolated from your local Machine.

If you are willing to Copy your Current Runtimes and Code into a docker container then you can use COPY in Dockerfile.