microsoft/Windows-Containers

Container size

BPCS-wit opened this issue · 11 comments

We discovered that the size of the compressed container is now ~2GB instead of 200MB

https://techcommunity.microsoft.com/t5/containers/reducing-the-size-of-windows-server-container-images-part-2/ba-p/3741795

I am using FROM mcr.microsoft.com/windows/servercore:ltsc2019

Does anyone else has this problem?

@BPCS-wit I am having the same issue.

Can you clarify what you're exactly measuring that is ~2GB? The article you're referencing is the delta layer of the image, which is different to the whole container image.

@BPCS-wit and @saadsaeed01: I see the compressed size for the delta layer of mcr.microsoft.com/windows/servercore:ltsc2019 (March 2024 release) is 441 MB while the base layer is 1.49 GB. Since it has been more than a year since we rebaselined our images, the increase from 200 MB to 441 MB is reasonable since new fixes are added each month as part of servicing.

@akarshm: Currently I don't know what I am missing, so maybe you have an idea.

My container had the following sizes:

7th July 2023 163.35 MB
12th July 2023 1998.46 MB
21st August 2023 2055.21 MB

The dockerfile always had been the same. Yet one of our artifacts changed with a size difference of 2kb

FROM mcr.microsoft.com/windows/servercore/iis:windowsservercore-ltsc2019
SHELL ["powershell"]

RUN Install-WindowsFeature NET-Framework-45-ASPNET ; \
    Install-WindowsFeature Web-Asp-Net45

@BPCS-wit: It seems like you are adding the ASP.NET bits to the IIS image based on Windows Server Core. Note that this is not the same as using the Windows Server Core base image standalone. I also don't think your July image can be as small as 163.35 MB since the server core image (base + delta) would run into GBs.

@akarshm that's strange. I use the docker on AWS. For more then two years the container showed ~160MB. All of a sudden it was 2GB. Yet I have no clue why. Therefore I started to search for possible hints and ended up here. Thank you for your time, but I think there is no obvious "solution".

@BPCS-wit: Since you mentioned July 7th, 2023, in your timestamp, I looked at the IIS images we published in June 2023 (see line 276). Even then, the size does not correspond to the 163.35 MB you mentioned. Even in that case, the layer 1 media is ~1.54 GB (screenshot below). It seems odd that you had a 160 MB IIS image built on a WS2019 Server Core base image.

image

The size of the image has not changed.
There has been a change to how the OS layers are embedded in the image. Previously they were external layers and Docker did not include them in the image size (which is rather nonsense)
Microsoft changed the licensing some time ago, which means that the OS layers can now also be delivered directly in the image.
Now Docker shows the correct size of the entire image

And yes, Windows Core images are large😉

This issue has been open for 30 days with no updates.
@akarshm, please provide an update or close this issue.

This issue has been open for 30 days with no updates.
@akarshm, please provide an update or close this issue.