Description
Proposal: Enable globalization invariant mode for all runtime images
We propose to reduce runtime images by ~12MB (compressed; ~31MB uncompressed) by no longer installing the ICU package for Debian- and Ubuntu-based images, and instead rely on globalization invariant mode, by default. The .NET runtime and libraries depend on ICU, on Linux, for globalization behaviors (sorting, time zones, currency symbols, date formats, ...). We already enable globalization invariant mode and do not install ICU with Alpine runtime images.
We propose to (A) take advantage of this size improvement for Debian and Ubuntu images, and (B) make .NET images symmetric across Linux distros. In short, we like what we did for Alpine, but no longer want Alpine to be a special case.
All Linux-based .NET SDK images will continue to contain ICU. For example, Alpine .NET SDK images contain ICU, even though Alpine runtime images do not. As a point of policy for SDK images, we value UX over size, and intend for SDK images to provide a "batteries included" model. This is, in part, because it is more inconvenient, for users, to add packages to SDK images for some scenarios. This is a tradeoff, as it adds an unfortunate point of asymmetry between runtime and SDK images, but one that we believe is warranted.
We made an analogous change in #1848 where we removed a Debian- and Ubuntu-specific layer that Alpine did not have. After that change, Debian and Ubuntu SDK images are smaller, and the layering across .NET SDK images for Linux distros is now the same.
Context
As part of the .NET Core 2.0 release, we created globalization invariant mode. This feature, when enabled, removes any dependence on external libraries for globalization information by using the invariant behavior for all globalization-sensitive APIs (like sorting, understanding time zones and writing currency symbols). For many applications, this mode is a win because they are not dependent on globalization concepts and behaviors.
This new mode was developed at the same time as we added support for the Alpine Linux distro. The Alpine project is known for publishing small container images, and we wanted to do everything we could to make Alpine-based .NET Core images small. We decided to take advantage of globalization invariant mode and not install ICU in Alpine images by default, and instead let users who need globalization enable it for themselves. This seemed like a great trade-off at the time, and we haven't heard any negative feedback on it. We have however heard that many people are happy with .NET Alpine images, and have seen their usage grow considerably.
Size details
We built the dotnetapp sample a few different ways and published the results at richlander/dotnetapp. The tags listing provides the compressed sizes. The same images are displayed below, with uncompressed size information.
rich@mazama:/mnt/d/git/dotnet-docker/samples/dotnetapp$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
richlander/dotnetapp debian c83a4ad65881 54 minutes ago 190MB
richlander/dotnetapp latest c83a4ad65881 54 minutes ago 190MB
richlander/dotnetapp alpine-globalization-enabled 1aa6fb6af249 2 hours ago 119MB
richlander/dotnetapp alpine 75670cc0cd25 2 hours ago 87.3MB
mcr.microsoft.com/dotnet/core/runtime 3.1-alpine 50c357d06fee 5 days ago 87.2MB
alpine latest f70734b6a266 5 days ago 5.61MB
Legend:
- dotnetapp:debian -- Dockerfile
- dotnetapp:alpine -- Dockerfile.alpine-x64
- dotnetapp:alpine-globalization-enabled- -- Dockerfile.alpine-x64 -- with these lines uncommented
Metadata
Metadata
Assignees
Type
Projects
Status