Skip to content

Conversation

@brandonh6k
Copy link
Contributor

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

  • Technical review
  • Editorial review
  • Product review

@netlify
Copy link

netlify bot commented Nov 17, 2025

Deploy Preview for docsdocker ready!

Name Link
🔨 Latest commit 613c975
🔍 Latest deploy log https://app.netlify.com/projects/docsdocker/deploys/691c6df5ddc82d0007149a9f
😎 Deploy Preview https://deploy-preview-23729--docsdocker.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

@craig-osterhout craig-osterhout left a 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.
Copy link
Contributor

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.

Suggested change
> **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
Copy link
Contributor

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
Copy link
Contributor

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 \
Copy link
Contributor

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"]
```
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants