Aspirerelease/17.0
Watch Aspire live streamsDocsTry Aspire

ContainerResource.WithContainerName

Method
📦 Aspire.Hosting v17.0.0
type ContainerResource interface {
// ... omitted for brevity
WithContainerName(name string) ContainerResource
}

Signature

methodWithContainerNamebuilder
Overrides the default container name for this resource. By default Aspire generates a unique container name based on the resource name and a random postfix (or a postfix based on a hash of the AppHost project path for persistent container resources). This method allows you to override that behavior with a custom name, but could lead to naming conflicts if the specified name is not unique.
WithContainerName(name string) ContainerResource
namestringThe desired container name. Must be a valid container name or your runtime will report an error.
ContainerResource

The resource builder.

Returns a handle; failures surface later via Err().

Defined on

This method is defined on the following type: