February 2022 update - to understand how the work blogged in this article from 2019 carries forward to the Windows container base images that ship in Windows Server 2022, please go to the official Windows container docs.
Windows Server Insider Preview builds have brought an exciting change to the Windows Server Core Container base image that we’d like to share with you. The Server Core Insider container base image download size is over 40% smaller than the 1903 base image, and container startup into Windows PowerShell is 30% faster!
This should be a big win for scaling applications in production, CI/CD, and any other workflow that benefits from faster startup or pulls uncached images.
For performance benefits, Server Core containers have always included a set of .NET pre-compiled native images generated by theNative Image Generator tool(Ngen.exe) to improve startup performance. Starting with our Insider images, the Server Core base image will include a much smaller set of NGEN images.
A larger set is included in.NET Framework runtime images(which are based on Windows Server Core), however, the .NET Framework runtime images are also much smaller because we can now ensure that there is only one copy of each NGEN image. Additionally, The NGEN images in the .NET Framework runtime image are now more intentionally selected to targetASP.NETand PowerShell performance. Tests have shown that container startup into Windows PowerShell has improved by 45% when using the Insider-based .NET Framework runtime image compared to the 1903 .NET Framework image.
How exactly have the sizes changed over time? Depends on what you measure sizes. Using the .NET team'smethod for retrieving Docker Image Sizes, here is how the latest Insider image compares to the first generally available* 1903 image, released in May 2019:
*[May, 22, 2020 Update]: Note that the 1903 image at time of general availability, includes an RTM ("Release to Manufacturing") layer, as well as a second layer containing a collection of monthly updates that accumulate over time.
Download Size (GB)
Size on Disk (GB)
Note that running docker pull on the latest Insider image at the time of writing (Insider Build 19023) will display a download size of 1.22. This is because Docker's method for calculating differs slightly from the method linked above.
Image sizes fluctuate month-to-month as they receive monthly servicing updates. The results of the metrics referenced in this and other related blogs will fluctuate accordingly. Note that the size of 1903 used as a benchmark in the related blogs below are based on a a more recent version of 1903, one that has been serviced with several monthly patches that each cause size increases.
These changes will remain available for preview to registered Insiders on all current and upcoming builds featured on thewindows/servercore/insiderrepo, and are expected to be Generally Available in the 20H1windows/servercore release in 2020
Going forward, container images that make significant use of .NET Framework or Windows PowerShell should be built on top of thedotnet/framework/runtime container images, which will include additional .NET pre-compiled native images to maintain performance for those scenarios.
Note that while tests show that container startupintoWindows PowerShell is 30% faster when using the Insider Server Core image when compared to 1903, Windows PowerShell startupwithina running container is 100ms (15%) slower for the Insider image and 20ms (15%) slower on the Insider-based .NET Framework runtime image, when compared to their respective 1903 equivalents.
We’d love for you to test out the smaller Server Core image today onwindows/servercore/insiderand give us your feedback! Also, remember to check out the.NET blogand look out for corresponding .NET Framework images when 20H1 Windows Server Core containers are Generally Available.