Last Update: Sep 04, 2024 | Published: Dec 23, 2019
At the beginning of December, Microsoft announced upcoming changes to Windows Server Core container images that would make them 40% smaller. In a post on the .NET Blog, .NET Team Program Manager Richard Lander says that Insider images are 40% smaller than the latest (patched) 1903 images, based on the images in the Windows Server Core insiders Docker repo. Additionally, startup times to Windows PowerShell are 30-45% faster. Lander says that the improvements should apply in any scenario where Windows Server Core container images are used and will be most beneficial for scaling apps, continuous integration and continuous delivery (CI/CD), and other situations where images are pulled without using a Docker image cache or where faster startup times are required.
Windows Server Core images include a series of pre-compiled .NET native images that are generated using a tool called Ngen.exe to improve startup performance. But the downside is that it also makes image size grow. The current Insider Windows Server Core images now include a significantly smaller set of NGEN images. A larger set of images is included in the .NET Framework runtime images, also based on Server Core, but are also smaller because Microsoft makes sure that there is only one copy of each NGEN image that target ASP.NET and PowerShell performance.
Investigations started at Microsoft a year ago based on the premise that the way the .NET Framework is packaged and installed doesn’t work well with Docker layers. On the back of this research, Microsoft defined three criteria to reduce image sizes.
Decreasing image size and maintaining startup performance was the biggest challenge as NGEN was the culprit for increased image size. To achieve its goals for the Windows Server Core base image layer, Microsoft made the following changes:
In the .NET Framework runtime image layer, the changes are as follows:
The images are currently available for Insiders here at the windows/servercore/insider repo but should be generally available in the windows/servercore repo when Windows 10 20H1 becomes generally available in the first half of 2020. Microsoft says that container images needing best performance for .NET Framework or Windows PowerShell should use the dotnet/framework/runtime repo. While the images are bigger, they offer better performance.