Watch Aspire live streamsDocsTry Aspire

addVolume

Method
📦 Aspire.Hosting.Docker v13.6.5
interface Service {
// ... omitted for brevity
addVolume(
source: string,
target: string,
type?: string,
isReadOnly?: boolean,
configure?: callback): Service;
}

Signature

methodaddVolume
Adds a volume mount to a generated Docker Compose service.
addVolume(source: string, target: string, type?: string, isReadOnly?: boolean, configure?: (obj: Volume) => Promise<void>): Service
sourcestringThe source volume name or host path.
targetstringThe target path inside the container.
typestringoptional= volumeThe Docker Compose volume type, such as `volume` or `bind`.
isReadOnlybooleanoptionalA value indicating whether the volume is mounted as read-only.
configure(obj: Volume) => Promise<void>optionalAn optional callback for further volume customization.
Service

Applies to

This method applies to the following types: