diff --git a/src/Aspire.Hosting/ApplicationModel/ContainerFileSystemCallbackAnnotation.cs b/src/Aspire.Hosting/ApplicationModel/ContainerFileSystemCallbackAnnotation.cs
index 736dd24f297..ed8ce8f63ef 100644
--- a/src/Aspire.Hosting/ApplicationModel/ContainerFileSystemCallbackAnnotation.cs
+++ b/src/Aspire.Hosting/ApplicationModel/ContainerFileSystemCallbackAnnotation.cs
@@ -82,14 +82,14 @@ public sealed class ContainerFileSystemCallbackAnnotation : IResourceAnnotation
public required string DestinationPath { get; init; }
///
- /// The UID of the default owner for files/directories to be created or updated in the container. Defaults to 0 for root.
+ /// The UID of the default owner for files/directories to be created or updated in the container. The UID defaults to 0 for root if null.
///
- public int DefaultOwner { get; init; }
+ public int? DefaultOwner { get; init; }
///
- /// The GID of the default group for files/directories to be created or updated in the container. Defaults to 0 for root.
+ /// The GID of the default group for files/directories to be created or updated in the container. The GID defaults to 0 for root if null.
///
- public int DefaultGroup { get; init; }
+ public int? DefaultGroup { get; init; }
///
/// The umask to apply to files or folders without an explicit mode permission. If set to null, a default umask value of 0022 (octal) will be used.
diff --git a/src/Aspire.Hosting/ContainerResourceBuilderExtensions.cs b/src/Aspire.Hosting/ContainerResourceBuilderExtensions.cs
index bfa71505fd3..3b1d47dc1e1 100644
--- a/src/Aspire.Hosting/ContainerResourceBuilderExtensions.cs
+++ b/src/Aspire.Hosting/ContainerResourceBuilderExtensions.cs
@@ -706,8 +706,8 @@ public static IResourceBuilder WithBuildSecret(this IResourceBuilder bu
/// The resource builder for the container resource.
/// The destination (absolute) path in the container.
/// The file system entries to create.
- /// The default owner UID for the created or updated file system. Defaults to 0 for root.
- /// The default group ID for the created or updated file system. Defaults to 0 for root.
+ /// The default owner UID for the created or updated file system. Defaults to 0 for root if not set.
+ /// The default group ID for the created or updated file system. Defaults to 0 for root if not set.
/// The umask permissions to exclude from the default file and folder permissions. This takes away (rather than granting) default permissions to files and folders without an explicit mode permission set.
/// The .
///
@@ -741,7 +741,7 @@ public static IResourceBuilder WithBuildSecret(this IResourceBuilder bu
/// defaultOwner: 1000);
///
///
- public static IResourceBuilder WithContainerFiles(this IResourceBuilder builder, string destinationPath, IEnumerable entries, int defaultOwner = 0, int defaultGroup = 0, UnixFileMode? umask = null) where T : ContainerResource
+ public static IResourceBuilder WithContainerFiles(this IResourceBuilder builder, string destinationPath, IEnumerable entries, int? defaultOwner = null, int? defaultGroup = null, UnixFileMode? umask = null) where T : ContainerResource
{
ArgumentNullException.ThrowIfNull(builder);
ArgumentNullException.ThrowIfNull(destinationPath);
@@ -769,8 +769,8 @@ public static IResourceBuilder WithContainerFiles(this IResourceBuilder
/// The resource builder for the container resource.
/// The destination (absolute) path in the container.
/// The callback that will be invoked when the resource is being created.
- /// The default owner UID for the created or updated file system. Defaults to 0 for root.
- /// The default group ID for the created or updated file system. Defaults to 0 for root.
+ /// The default owner UID for the created or updated file system. Defaults to 0 for root if not set.
+ /// The default group ID for the created or updated file system. Defaults to 0 for root if not set.
/// The umask permissions to exclude from the default file and folder permissions. This takes away (rather than granting) default permissions to files and folders without an explicit mode permission set.
/// The .
///
@@ -814,7 +814,7 @@ public static IResourceBuilder WithContainerFiles(this IResourceBuilder
/// });
///
///
- public static IResourceBuilder WithContainerFiles(this IResourceBuilder builder, string destinationPath, Func>> callback, int defaultOwner = 0, int defaultGroup = 0, UnixFileMode? umask = null) where T : ContainerResource
+ public static IResourceBuilder WithContainerFiles(this IResourceBuilder builder, string destinationPath, Func>> callback, int? defaultOwner = null, int? defaultGroup = null, UnixFileMode? umask = null) where T : ContainerResource
{
ArgumentNullException.ThrowIfNull(builder);
ArgumentNullException.ThrowIfNull(destinationPath);
diff --git a/src/Aspire.Hosting/Dcp/Model/Container.cs b/src/Aspire.Hosting/Dcp/Model/Container.cs
index 4a1af7312c5..0e1ca6bf268 100644
--- a/src/Aspire.Hosting/Dcp/Model/Container.cs
+++ b/src/Aspire.Hosting/Dcp/Model/Container.cs
@@ -295,11 +295,13 @@ internal sealed class ContainerCreateFileSystem : IEquatable