skip to Main Content

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?

2

Answers


  1. When you build a Docker image using the FROM instruction, Docker checks if the base image specified in the Dockerfile is present locally. If the base image is not present, it will be downloaded from the Docker registry. In your case, since you have the .NET Framework 4.8 SDK and runtime installed on your local machine, Docker will not download the SDK and runtime layers from the internet. Instead, it will use the layers already present on your machine to create the image.

    The Docker build process works by creating layers for each step in the Dockerfile. The layers are cached, which enables faster subsequent builds. If you use the same base image in different Dockerfiles, the layers will be reused, provided that the layers have not changed.

    Login or Signup to reply.
  2. When you define FROM mcr.microsoft.com/dotnet/framework/sdk:4.8 It will pull the specified base image from the container registry and use it as a starting point to build your Docker image.

    It won’t reuse or create a layer from the .NET Framework SDK and runtime installed on your local machine. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search