Aspirerelease/17.0
Watch Aspire live streamsDocsTry Aspire

ComposeFile

Handle
📦 Aspire.Hosting.Docker v17.0.0

Represents a Docker Compose file with properties and configurations for services, networks, volumes, secrets, configs, and custom extensions.

type ComposeFile interface{}

Properties

propertyConfigs*Dict[string, Config]get · set
Represents a collection of configuration objects within a Docker Compose file. Each key in the dictionary corresponds to a configuration name, and the value is an instance of the Config class that contains the associated configuration details.
Configs() *Dict[string, Config]
SetConfigs(value *Dict[string, Config]) ComposeFile
propertyExtensions*Dict[string, any]get · set
Represents a collection of user-defined extension fields that can be added to the Compose file. These extensions are represented as a dictionary where the key is a string identifier for the extension, and the value is an object that holds the custom data relevant to the extension. This allows flexibility for including additional metadata or configuration outside the scope of standard Compose file specifications.
Extensions() *Dict[string, any]
SetExtensions(value *Dict[string, any]) ComposeFile
propertyName*stringget · set
Represents the name of the Docker Compose file or project.
Name() (*string, error)
SetName(value *string) ComposeFile
propertyNetworks*Dict[string, Network]get · set
Represents the collection of networks defined in a Docker Compose file.
Networks() *Dict[string, Network]
SetNetworks(value *Dict[string, Network]) ComposeFile
propertySecrets*Dict[string, Secret]get · set
Represents the secrets section in a Docker Compose file. Contains a collection of secret definitions used within the Compose file.
Secrets() *Dict[string, Secret]
SetSecrets(value *Dict[string, Secret]) ComposeFile
propertyServices*Dict[string, Service]get · set
Represents a collection of services defined in a Docker Compose file. Each service is identified by a unique name and contains configuration details as defined by the Service class.
Services() *Dict[string, Service]
SetServices(value *Dict[string, Service]) ComposeFile
propertyVersion*stringget · set
Represents the version of the Docker Compose file format being used. This property specifies the format of the Compose file and determines the supported features and behaviors.
Version() (*string, error)
SetVersion(value *string) ComposeFile
propertyVolumes*Dict[string, Volume]get · set
Represents a collection of volume definitions within a Docker Compose file.
Volumes() *Dict[string, Volume]
SetVolumes(value *Dict[string, Volume]) ComposeFile

Methods

methodAddConfig
Adds a top-level config definition to the Docker Compose file.
AddConfig(
name string,
options ...*AddConfigOptions,
) ComposeFile
namestringThe name of the config.
options...*AddConfigOptionsOptional settings, described under Options.

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

File*stringThe path to the config file.
Content*stringThe inline config content.
External*boolA value indicating whether the config is managed outside the generated Compose file.
Configurefunc(obj Config)callbackAn optional callback for further config customization.
ComposeFile

The updated Docker Compose file.

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

Adds a top-level network definition to the Docker Compose file.
AddNetwork(
name string,
options ...*AddNetworkOptions,
) ComposeFile
namestringThe name of the network.
options...*AddNetworkOptionsOptional settings, described under Options.

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

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

The updated Docker Compose file.

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

methodAddSecret
Adds a top-level secret definition to the Docker Compose file.
AddSecret(
name string,
options ...*AddSecretOptions,
) ComposeFile
namestringThe name of the secret.
options...*AddSecretOptionsOptional settings, described under Options.

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

File*stringThe path to the secret file.
External*boolA value indicating whether the secret is managed outside the generated Compose file.
Configurefunc(obj Secret)callbackAn optional callback for further secret customization.
ComposeFile

The updated Docker Compose file.

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

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().

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().