December 9th, 2019

Improvements in Windows PowerShell Container Images

Joey Aiello
Program Manager

Beginning with Windows Server 20H1 Insider builds, Windows Server Core Insider images have been reduced in size from ~2.1 GBs to ~1.1 GBs.

How did the Server Core images get over 40% smaller?

Traditionally, Windows 10 and Windows Server have always included a set of .NET native binaries that were pre-compiled using the Native Image Generator tool (Ngen.exe). This native pre-compilation makes these binaries faster on default installations of the OS, but it also makes the image size grow: managed/IL .NET binaries are typically smaller and slower initially (until JIT compilation happens) than their native counterparts (with another tradeoff being that the latter are not portable between platforms and architectures).

For more details, check out corresponding blogs published by the .NET team and the Windows Server team.

What does this mean for me as a PowerShell user?

If you depend on Windows Server container images for usage of Windows PowerShell, and you value performance, you should switch from the windows/servercore images to the dotnet/framework/runtime images. The latter are specifically optimized for .NET Framework workloads like Windows PowerShell.

And in fact, switching to the new dotnet/framework/runtime images will actually provide a greater benefit to startup performance even over the old windows/servercore images. When running Measure-Command { docker run --rm <image> powershell -c "echo 1" } on a Windows box, observe the following differences:

windows/servercore:1903 windows/servercore/insider:10.0.19023.1 dotnet/framework/runtime:4.8-20191008-windowsservercore-1903 dotnet/framework/runtime:4.8-windowsservercore-2004
7.34 sec 5.41 sec 6.8 sec 3.76 sec

 

What if I’m using PowerShell Core instead of Windows PowerShell in my containers?

If have already moved your workloads from Windows PowerShell to PowerShell Core, you should continue to use the windowsservercore images from microsoft/powershell, and when the Windows Server reductions graduate from Insiders you’ll simply enjoy the benefit of smaller image sizes.

That’s it!

Thanks to everyone leveraging PowerShell in Docker containers! And make sure to file any issues you have in our powershell-docker repository.

Thanks, Joey Aiello Program Manager, PowerShell

Category
PowerShell

Author

Joey Aiello
Program Manager

Program Manager at Microsoft for PowerShell Core

3 comments

Discussion is closed. Login to edit/delete existing comments.

  • Ayan Mullick

    The latest version is probably still unsupported on ACI.

    `New-AzContainerGroup -ResourceGroupName ContainerTest -Name corepre -Image mcr.microsoft.com/windows/servercore/insider:10.0.19023.1 -OsType Windows -DnsNameLabel CorePre -Location NorthCentralUS -Cpu 1 -MemoryInGB 1 -RestartPolicy OnFailure -IpAddressType Public -Port 80,5985,5986 -Verbose`

    VERBOSE: Performing the operation “Create Container Group” on target “corepre”.
    New-AzContainerGroup : The Windows version of image ‘mcr.microsoft.com/windows/servercore/insider:10.0.19023.1’ is not supported. The supported Windows versions are: ‘10.0.14393,10.0.17763’.

  • byte head

    All we need is a native Active Directory Module guys
    Else its 5.1 for the forseeable future