-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide distroless base image for dotnet core runtime dependencies. #2074
Comments
@TonyDou - Can you explain the usage scenarios in which a distroless base image would be advantageous over using the Alpine based .NET image? Alpine is our smallest and most secure offering. |
@TonyDou - Can you share your usage scenario? |
Hi @MichaelSimons It's true that Alpine is already very small but it also contains binaries like sh that's not referenced or used by dotnet runtime. The request is more about security concerns not about image size. If we remove binaries in base image as much as possible, the potential security vulnerabilities will be fewer. |
One is already provided by distroless repo It would be better if the dotnet team maintains this so that we get the latest dotnet as well as the correct dependences for all features. |
We've heard a couple requests for this but not a significant amount. Adding support for distroless images is a significant cost because it requires adopting a new tool chain. It is more work than adding images for an already supported distro. We would like to hear from others who would find this useful and what their motivations are. We will close this issue in 30 days if we do not hear from a substantial number of users. |
Also I would like to add that since we only have the essential so's, the rate of scanning alerts reduce a lot. |
Closing per the 30 day comment I made earlier. If you would find distroless images useful, please continue to share your scenario/comments. |
An important distinction of distroless from Alpine is the availability of glibc (when using distroless/cc) for applications that use native libraries that expect to find debian libs. Alpine uses musl which is only partially compatible with glibc. In my experience this usually leads to recompiling from source which can be tricky if there are complex dependencies. |
Alpine also has known DNS issues in K8s environments: https://stackoverflow.com/questions/65181012/does-alpine-have-known-dns-issue-within-kubernetes |
Ended up with something like this: Runtime image:
Usage:
|
Came across #3141, so there might be some movement on this? |
@torjue - We're interested in distroless and exploring that space. And yes, #3141 is an implementation of that but just for CBL-Mariner. Your sample shows Alpine being used and there's recently been some tooling prototype developed for Alpine to enable distroless support. I've done a prototype on top of that for .NET and it yielded good results. Distroless is definitely on our radar but we have no concrete plans for it other than #3141. |
Based on the info from @torjue I put together this repo showing .NET image sizes: https://github.com/dpbevin/dotnet-staticfiles. It looks like the base image The final Dockerfile is hardened with:
|
We've been talking with the Alpine Witchery folks. We're likely to support that. We need to finish our Mariner project first and better understand both the construction of those images and the maintenance. Distroless is almost Docker v2. |
this make be helpful to some folks, that how I build distroless dotnet image based on debian packages in a way that security scanner can detect installed dependencies: https://github.com/616b2f/distroless-dotnet/blob/main/Dockerfile |
@richlander you most likely want checkout Wolfi (direct link to code) too as it takes Distroless completely new level. Afaiu by comparing their code and runtime-deps for CBL mariner there most likely is already support for all other needed libraries expect |
The benefits of distroless base image for dotnet core is mainly for security.
The text was updated successfully, but these errors were encountered: