Aspirerelease/17.0
Watch Aspire live streamsDocsTry Aspire

WithVolume

Method
📦 Aspire.Hosting v17.0.0
func (ContainerResource) WithVolume(
target string,
options ...*WithVolumeOptions,
) ContainerResource

Signature

methodWithVolumebuilder
Adds a volume to a container resource.
WithVolume(
target string,
options ...*WithVolumeOptions,
) ContainerResource
targetstringThe mount path inside the container.
options...*WithVolumeOptionsOptional settings, described under Options.

Optional parameters are passed in a trailing options ...*WithVolumeOptions argument.

Name*stringThe volume name. If null, an anonymous volume is created.
IsReadOnly*boolWhether the volume is read-only.
ContainerResource

The same resource builder handle for chaining.

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

Applies to

This method applies to the following types: