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
-
Removal of buildpack-deps from 5.0 SDK Docker images
Starting with .NET 5.0, SDK Docker images will no longer have
buildpack-deps
as 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-deps
and Nano Server was previously based on the basenanoserver
image. These images are all now based onaspnet
.sdk:5.0-buster
buildpack-deps:buster-scm
aspnet:5.0-buster-slim
sdk:5.0-focal
buildpack-deps:focal-scm
aspnet:5.0-focal
sdk:5.0-alpine
runtime-deps:5.0
aspnet:5.0-alpine
sdk:5.0-nanoserver
nanoserver
aspnet:5.0-nanoserver
To compensate for the loss of
buildpack-deps
for Debian and Ubuntu, the following list of packages have been added to those SDK images:curl
git
wget
Related 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:scm
can be easily discovered by looking at the following Dockerfiles, for thecurl
andscm
layers.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-deps
stage, 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:scm
for 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-deps
dependency 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-deps
image 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-deps
was needed (as part ofsdk
images). We have plenty of evidence that the layer is problematic, and can deliver a sizable performance improvement to anyone using thesdk
and aruntime
oraspnet
image 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
sdk
image in order to build the application and then pulling theaspnet
orruntime
image to contain the published application. Before these changes, there was no layer sharing between the runtime-based images (aspnet
andruntime
) and thesdk
image. 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,sdk
is now based on theaspnet
image which means that once you've pulledsdk
, you also now have theaspnet
andruntime
layers. This provides substantial download savings when both images need to be pulled.Ubuntu 20.04 (Focal)
ASP.NET App
sdk
imageaspnet
imageNet download savings: 102 MB (-31%)
Console App
sdk
imageruntime
imageNet download savings: 47 MB (-17%)
Debian 10 (Buster)
ASP.NET App
sdk
imageaspnet
imageNet download savings: 124 MB (-37%)
Console App
sdk
imageruntime
imageNet download savings: 117 MB (-35%)
Beta Was this translation helpful? Give feedback.
All reactions