-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Update .NET guide to .NET 10 #23729
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
base: main
Are you sure you want to change the base?
Update .NET guide to .NET 10 #23729
Conversation
✅ Deploy Preview for docsdocker ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
craig-osterhout
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @brandonh6k. It looks like the v10 DHI images just dropped. Suggest updating to those, or somehow make sure the v9 build will work with the updated sample app.
|
|
||
| > [Docker Hardened Images (DHIs)](https://docs.docker.com/dhi/) are minimal, secure, and production-ready container base and application images maintained by Docker. DHI images are recommended for better security—they are designed to reduce vulnerabilities and simplify compliance. | ||
| > **Note**: DHI for .NET 10 is not yet available. The following DHI example uses .NET 9. Check the [DHI catalog](https://hub.docker.com/hardened-images/catalog) for .NET 10 availability, or use the official image tab below for .NET 10. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like 10 was just added after you drafted this.
| > **Note**: DHI for .NET 10 is not yet available. The following DHI example uses .NET 9. Check the [DHI catalog](https://hub.docker.com/hardened-images/catalog) for .NET 10 availability, or use the official image tab below for .NET 10. | |
| > [!NOTE] | |
| > | |
| > The following DHI example uses .NET 9. Check the [DHI catalog](https://hub.docker.com/hardened-images/catalog) for .NET 10 availability, or use the official image tab below for .NET 10. |
| ```dockerfile {title=Dockerfile} | ||
| # syntax=docker/dockerfile:1 | ||
|
|
||
| FROM --platform=$BUILDPLATFORM <your-namespace>/dhi-dotnet:9.0-alpine AS build |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got an error from this image. Tag does not exist and I think the sdk variant is required to build.
Updated the tag to 9.0-sdk-alpine3.22 and it gets past it.
| RUN --mount=type=cache,id=nuget,target=/root/.nuget/packages \ | ||
| dotnet publish -a ${TARGETARCH/amd64/x64} --use-current-runtime --self-contained false -o /app | ||
|
|
||
| FROM <your-namespace>/dhi-aspnetcore:9.0-alpine AS final |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get an error from this image. Tag does not exist. Updating the tag to 9.0-alpine3.22 gets past it.
| WORKDIR /app | ||
| COPY --from=build /app . | ||
| ARG UID=10001 | ||
| RUN adduser \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I get an error from adduser. I don't think it's included in the image.
Runtime variants already run as a non-root user, so suggest removing all the pieces for adding and running as the appuser.
| appuser | ||
| USER appuser | ||
| ENTRYPOINT ["dotnet", "myWebApp.dll"] | ||
| ``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even after the above changes, the app still fails to run because it appears to be not compatible with either the original v8 app, or the changes to update the app to v10.
Suggest updating this to use the new v10 and test it with the updated v10 app.
Description
Errr... I updated the .NET guide to 10. 😆
Related issues or tickets
The sample .NET repo has a PR as well - docker/docker-dotnet-sample#9
Reviews