Aspirerelease/17.0
Watch Aspire live streamsDocsTry Aspire

AddVolume

Method
📦 Aspire.Hosting.Docker v17.0.0
func (Service) AddVolume(
source string,
target string,
options ...*ServiceAddVolumeOptions,
) Service

Signature

methodAddVolume
Adds a volume mount to a generated Docker Compose service.
AddVolume(
source string,
target string,
options ...*ServiceAddVolumeOptions,
) Service
sourcestringThe source volume name or host path.
targetstringThe target path inside the container.
options...*ServiceAddVolumeOptionsOptional settings, described under Options.

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

Type*stringThe Docker Compose volume type, such as volume or bind.
IsReadOnly*boolA value indicating whether the volume is mounted as read-only.
Configurefunc(obj Volume)callbackAn optional callback for further volume customization.
Service

The updated Docker Compose service.

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

Applies to

This method applies to the following types: