ComposeFile
Class sealed net10.0
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{ // ...} 14 members
Remarks
Section titled Remarks 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.
Constructors1
Section titled ConstructorsProperties8
Section titled PropertiesConfigsget; setDictionary<string, Config> 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. Extensionsget; setDictionary<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; setstring? Represents the name of the Docker Compose file or project.
Networksget; setDictionary<string, Network> Represents the collection of networks defined in a Docker Compose file.
Secretsget; setDictionary<string, Secret> Represents the secrets section in a Docker Compose file. Contains a collection of secret definitions used within the Compose file.
Servicesget; setDictionary<string, Service> 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. Versionget; setstring? 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; setDictionary<string, Volume> Represents a collection of volume definitions within a Docker Compose file.
Methods5
Section titled MethodsAddConfig(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.