Aspirerelease/17.0
Watch Aspire live streamsDocsTry Aspire

AddService

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

Signature

methodAddService
Adds a service definition to the Docker Compose file.
AddService(
name string,
options ...*AddServiceOptions,
) ComposeFile
namestringThe name of the service.
options...*AddServiceOptionsOptional settings, described under Options.

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

Image*stringThe container image to use for the service.
Configurefunc(obj Service)callbackAn optional callback for further service customization.
ComposeFile

The updated Docker Compose file.

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

Applies to

This method applies to the following types: