Skip to content
Docs Try Aspire

ComposeFile

Class sealed net10.0
📦 Aspire.Hosting.Docker v13.1.2-preview.1.26125.13
Represents a Docker Compose file with properties and configurations for services, networks, volumes, secrets, configs, and custom extensions.
namespace Aspire.Hosting.Docker.Resources;
public sealed class ComposeFile
{
// ...
}
This class is designed to encapsulate the structure of a Docker Compose file as a strongly-typed model. It supports serialization to YAML format for usage in Docker Compose operations.
View all constructors
Configsget; set
Dictionary<string, Config>
Extensionsget; set
Dictionary<string, object>
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.
Nameget; set
string?
Represents the name of the Docker Compose file or project.
Networksget; set
Dictionary<string, Network>
Represents the collection of networks defined in a Docker Compose file.
Secretsget; set
Dictionary<string, Secret>
Represents the secrets section in a Docker Compose file. Contains a collection of secret definitions used within the Compose file.
Servicesget; set
Dictionary<string, Service>
Versionget; set
string?
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.
Volumesget; set
Dictionary<string, Volume>
Represents a collection of volume definitions within a Docker Compose file.
View all properties
AddConfig(Config)
Adds a new config entry to the Compose file.
AddNetwork(Network)
Adds a new network to the Compose file.
AddService(Service)
Adds a new service to the Compose file.
AddVolume(Volume)
Adds a new volume to the Compose file.
ToYaml(string)
string
Converts the current instance of ComposeFile to its YAML string representation.
View all methods