Breaking Change: Removal of buildpack-deps in 5.0 SDK Docker images #3675
mthalman
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.
-
Removal of buildpack-deps from 5.0 SDK Docker images
Starting with .NET 5.0, SDK Docker images will no longer have
buildpack-depsas a parent image for Debian and Ubuntu. This breaking change was made as part of a larger effort to enable more layer sharing amongst the set of Docker images. It also helps to reduce the security vulnerability surface area by virtue of simply having less software installed in these images.Details
As mentioned above, this change was part of a larger effort to maximize layer sharing, resulting in more efficient transfers of images. This change was also applied to the Alpine and Nano Server SDK images. Alpine was previously based on
runtime-depsand Nano Server was previously based on the basenanoserverimage. These images are all now based onaspnet.sdk:5.0-busterbuildpack-deps:buster-scmaspnet:5.0-buster-slimsdk:5.0-focalbuildpack-deps:focal-scmaspnet:5.0-focalsdk:5.0-alpineruntime-deps:5.0aspnet:5.0-alpinesdk:5.0-nanoservernanoserveraspnet:5.0-nanoserverTo compensate for the loss of
buildpack-depsfor Debian and Ubuntu, the following list of packages have been added to those SDK images:curlgitwgetRelated Issues
Breaks and Workarounds
If you rely on tools provided by
buildpack-deps:scm(beyond the three mentioned above), you will be broken by this change when transitioning to .NET 5.0.The complete list of tools provided by
buildpack-deps:scmcan be easily discovered by looking at the following Dockerfiles, for thecurlandscmlayers.For Debian:
For Ubuntu:
If you rely on these tools as part of
docker build, you are encouraged to install the required tool(s) yourself in your Dockerfile, or rely on multi-stage build, by using abuildpack-depsstage, as we do for .NET runtime images.If you rely on these tools as part of
docker run, you can potentially install them via a script.Context
Since .NET Core 1.0, we've been releasing SDK images on top of buildpack-deps images. We made this choice for two reasons:
buildpacks-deps:scm(example), which contains curl.This made choosing
buildpacks-deps:scmfor the .NET Core SDK images an easy choice. We did that and moved on.Later, Docker developed the multi-stage-build feature, which opened up many new possibilities. In particular, this feature enables you to download or build assets in one stage, and then copy into another. That's a pattern we've adopted for our runtime images.
We realized early on that the
buildpack-depsdependency was problematic because it meant that the SDK images could not depend on runtime images. This means for multi-stage builds that you download the runtime twice, once with the SDK and another time for the final image. That's very unfortunate.Both Windows and Alpine don't have a
buildpack-depsimage offered. That means that we had more freedom on how to layer those images.Upon further thought, we realized that we didn't have any actual customer evidence that
buildpack-depswas needed (as part ofsdkimages). We have plenty of evidence that the layer is problematic, and can deliver a sizable performance improvement to anyone using thesdkand aruntimeoraspnetimage in a workflow (multi-stage build of a .NET image would be the most obvious example). We believe that this change will have a large positive impact on millions of builds ever day, and have a massive impact on any commercial build host.We hope that we can deliver this benefit to .NET docker image users. In particular, we hope that we can find satisfactory workarounds for users that are impacted by this change.
Size Impact
Here's a comparison of the benefits these changes provide in terms of the download cost savings. The canonical scenarios here are a multi-stage Dockerfile that builds and publishes either an ASP.NET app (see the sample ASP.NET Core Dockerfile) or .NET Console app (see the sample .NET Dockerfile). The scenario involves first pulling the
sdkimage in order to build the application and then pulling theaspnetorruntimeimage to contain the published application. Before these changes, there was no layer sharing between the runtime-based images (aspnetandruntime) and thesdkimage. This was wasteful because the SDK image does contain both ASP.NET Core and runtime bits; it just wasn't based on either of those images. With the changes that were made here,sdkis now based on theaspnetimage which means that once you've pulledsdk, you also now have theaspnetandruntimelayers. This provides substantial download savings when both images need to be pulled.Ubuntu 20.04 (Focal)
ASP.NET App
sdkimageaspnetimageNet download savings: 102 MB (-31%)
Console App
sdkimageruntimeimageNet download savings: 47 MB (-17%)
Debian 10 (Buster)
ASP.NET App
sdkimageaspnetimageNet download savings: 124 MB (-37%)
Console App
sdkimageruntimeimageNet download savings: 117 MB (-35%)
Beta Was this translation helpful? Give feedback.
All reactions