Aspirerelease/17.0
Watch Aspire live streamsDocsTry Aspire

AddVolume

Method
📦 Aspire.Hosting.Docker v17.0.0
func (ComposeFile) AddVolume(
name string,
options ...*AddVolumeOptions,
) ComposeFile

Signature

methodAddVolume
Adds a top-level volume definition to the Docker Compose file.
AddVolume(
name string,
options ...*AddVolumeOptions,
) ComposeFile
namestringThe name of the volume.
options...*AddVolumeOptionsOptional settings, described under Options.

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

Driver*stringThe volume driver to use.
External*boolA value indicating whether the volume is managed outside the generated Compose file.
Configurefunc(obj Volume)callbackAn optional callback for further volume customization.
ComposeFile

The updated Docker Compose file.

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

Applies to

This method applies to the following types: