Skip to content
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

.NET 8 preview 6 containers do not run as app user #479

Closed
wazzamatazz opened this issue Jul 20, 2023 · 2 comments · Fixed by dotnet/sdk#34154
Closed

.NET 8 preview 6 containers do not run as app user #479

wazzamatazz opened this issue Jul 20, 2023 · 2 comments · Fixed by dotnet/sdk#34154
Milestone

Comments

@wazzamatazz
Copy link

I have an ASP.NET Core application targeting .NET 8 with a container image built using the DefaultContainer profile.

Since updating to preview 6 of the SDK I've noticed that the application no longer runs as the app user. I initially thought that it was an issue with the base image but I've found that I can only replicate it when building the container image using the SDK publish profile.

I think it's related to this change to the app user UID in the base image as there is still an open issue here about the UID being hard-coded in places instead of using the APP_UID variable.

The workaround is to explicity run the container as UID 1654.

@mthalman
Copy link
Member

The issue is here: https://github.com/dotnet/sdk/blob/9e5c47e2bd7fe2d58ff6a7a666086b5ea7e8fd67/src/Containers/packaging/build/Microsoft.NET.Build.Containers.targets#L115-L116

This needs to change to 1654 because of the change in dotnet/dotnet-docker#4715.

@baronfel
Copy link
Member

More broadly we need to do processing of environment variables during image construction and programmatically set the user if we see the new environment variables, instead of hard coding it as we do now
This is similar to what we need to do for ASPNETCORE_URLS and Container ports, which I wrote up yesterday.

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

Successfully merging a pull request may close this issue.

3 participants