Breaking change: Alpine image dependencies changing (size and CVE affecting) #4784
richlander
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
.NET Alpine images are being changed to force package upgrades, which may reduce CVEs in .NET images and/or increase images sizes. .NET 8 Alpine images are (in addition) being updated to no longer install
krb5-libs(Kerberos) and use a different version ofca-certificates, which will provide a minor size improvement.If you require Kerberos, you will need to install the
krb5-libsyourself in your .NET 8+ images.Note: These changes only apply to packages installed in .NET images (that Microsoft publishes) and don't affect packages installed at higher layers.
Context:
ca-certificatesfrom Alpineruntime-depsimage (.NET 8) #4751Details
The following information details size changes, all based on live data (as of July 28, 2023) on the x64 architecture.
Status quo:
alpine-- 7.33MB (updated 6 weeks ago)mcr.microsoft.com/dotnet/runtime-deps:6.0-alpine-- 12.3MB (updated 2 weeks ago)mcr.microsoft.com/dotnet/runtime-deps:7.0-alpine-- 12.3MB (updated 2 weeks ago)mcr.microsoft.com/dotnet/runtime-deps:8.0-preview-alpine-- 12.3MB (updated 2 weeks ago)New approach (starting August; using
alpineimage and package archive as of today):mcr.microsoft.com/dotnet/runtime-deps:6.0-alpine-- 17.9MBmcr.microsoft.com/dotnet/runtime-deps:7.0-alpine-- 17.9MBmcr.microsoft.com/dotnet/runtime-deps:8.0-preview-alpine-- 14.9MBThe fact that the
alpineimage is six weeks old means that packages we install have likely been updated (and they have been). If a newalpineimage shipped today, then there would be just one set of packages amongst all image layers. We'd expect the following image sizes in that scenario.mcr.microsoft.com/dotnet/runtime-deps:6.0-alpine-- 12.3MBmcr.microsoft.com/dotnet/runtime-deps:7.0-alpine-- 12.3MBmcr.microsoft.com/dotnet/runtime-deps:8.0-preview-alpine-- 9.88MBYou might ask if there is a way for us to avoid the bloating of these images as packages get updated. We have considered producing Alpine distroless images. Please provide us feedback on that if you think it is important.
Note: Our Ubuntu Chiseled images don't have the image bloat problem. They only ever contain one version of each package.
The following sections go into more detail.
Force package upgrades
We recently discovered that we were not forcing upgrades of the packages we install, for Alpine. Our Debian and Ubuntu images do not have this problem. Alpine requires the use of
apk add --upgradeto force upgrade of packages that are already installed. We did not know that nor did anyone report this to us. Oops!libssl3is a critical package that we install, per ~/src/runtime-deps/8.0/alpine3.18/amd64/Dockerfile. .NET 6 and 7 variants are the same. That means thatlibssl3, for example, will not have been updated when a new package is available beyond what is installed in thealpinebase image.You can see this behavior in the following example.
Starting in August 2023, our
runtime-depsDockerfiles for Alpine will be updated to include--upgradefor ourapk addcommands. We will make this change for .NET 6, 7, and 8 images. We consider this a correctness change. It is unfortunate that image sizes will increase, but we don't feel we have any choice.Removing
krb5-libsandca-certificatesFor .NET 8 images, we found opportunities to reduce images size. We are not applying these changes to .NET 6 and 7 because these changes are breaking.
We found that Alpine images include the
ca-certificates-bundlepackage. It includes everything we need from theca-certificatespackage that we have been installing. That means that we've been unknowingly duplicating content. We will not install theca-certificatespackage going forward (for .NET 8+).We've always seen the Alpine images as more opinionated than our Debian and Ubuntu images. For example, we don't installed the ICU (globalization) package. Kerberos is much more niche than ICU in our view. We will not install the
krb5-libspackage going forward (for .NET 8+).Kerberos is often used with LDAP. We don't install install LDAP packages, so for folks that are installing LDAP and using it with Kerberos, this change should not be too onerous.
Kerberos can be installed via the following command.
RUN apk add --upgrade krb5-libsBeta Was this translation helpful? Give feedback.
All reactions