You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Assert.Contains(logs.Messages, m =>m.Message?.Contains("'ContainerImageName' was not a valid container image name, it was normalized to 'dotnet-testimage'")==true);
@@ -68,13 +69,13 @@ public void RegexCatchesInvalidContainerNames()
instance.Build(new[]{ComputeContainerConfig},null,null,outvaroutputs).Should().BeTrue("Build should have succeeded");
114
+
instance.Build(new[]{ComputeContainerConfig},null,null,outvaroutputs).Should().BeTrue("Build should have succeeded but failed due to {0}",String.Join("\n",logger.AllMessages));
109
115
varlabels=instance.GetItems(ContainerLabel);
110
116
if(includeSourceControl)
111
117
{
@@ -121,32 +127,54 @@ public void ShouldNotIncludeSourceControlLabelsUnlessUserOptsIn(bool includeSour
Copy file name to clipboardExpand all lines: docs/ContainerCustomization.md
+21Lines changed: 21 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -207,6 +207,27 @@ ContainerEntrypointArg items have one property:
207
207
</ItemGroup>
208
208
```
209
209
210
+
## ContainerUser
211
+
212
+
This item controls the default user that the container will run as. This is often used to run the container as a non-root user, which is a best practice for security. There are a few constraints to know about this field:
213
+
214
+
* It can take a variety of forms - user name, linux user ids, group name, linux group id, `username:groupname`, id variants of the above
215
+
* There is no verification that the user or group specified exists on the image
216
+
* Changing the user can alter the behavior of the application, especially in regards to things like File System permissions
217
+
218
+
The default value of this field varies by project TFM and target operating system:
219
+
220
+
* if you are targeting .NET 8 or higher and using the Microsoft runtime images, then
221
+
* on Linux the rootless user `app` will be used (though it will be referenced by its user id)
222
+
* on Windows the rootless user `ContainerUser` will be used
223
+
* otherwise no default `ContainerUser` will be used
Labels are often used to provide consistent metadata on container images. This package provides some default labels to encourage better maintainability of the generated images, drawn from the set defined as part of the [OCI Image specification](https://github.com/opencontainers/image-spec/blob/main/annotations.md). Where possible, we use the values of common [NuGet Project Properties](https://learn.microsoft.com/en-us/nuget/reference/msbuild-targets#pack-target) as defaults for these annotations, though we also provide more specific properties for each of these labels.
0 commit comments