Why did this "mcr.microsoft.com/dotnet/aspnet" image grow from 300 MB to 4 GB on Windows?

88 Views Asked by At

I recently migrated an ASP.NET Core running in a Windows container provided by Microsoft from .NET 7 to .NET 8.

The official default ASP.NET Core image is now 10 times bigger. Why?

> docker images
mcr.microsoft.com/dotnet/aspnet   8.0.0-windowsservercore-ltsc2022   175b932722fc   8 weeks ago    4.36GB
mcr.microsoft.com/dotnet/aspnet   7.0                                6a62cbd93ce2   3 months ago   393MB
1

There are 1 best solutions below

0
Guru Stron On

For Windows-based container images (otherwise you may be comparing Linux-based and Windows-based images) according to the Nano Server 2022 amd64 Tags table from the Docker hub page:

Tag Dockerfile Last Modified
8.0.1-nanoserver-ltsc2022, 8.0-nanoserver-ltsc2022 Dockerfile 01/09/2024
7.0.15-nanoserver-ltsc2022, 7.0-nanoserver-ltsc2022, 7.0.15, 7.0 Dockerfile 01/09/2024
6.0.26-nanoserver-ltsc2022, 6.0-nanoserver-ltsc2022, 6.0.26, 6.0 Dockerfile 01/09/2024

7.0 was using Nano Server as base image:

Nano Server is an ultralight Windows offering for new application development.

While you have switched to one using Windows Server Core 2022:

Server Core is medium in size and a good option for "lifting and shifting" Windows Server apps.

Try using 8.0-nanoserver-ltsc2022 as base.

See also Nano Server x Server Core x Server - Which base image is the right one for you? article.