Skip to content
DocsTry Aspire
DocsTry

ComposeFile Methods

ClassMethods5 members
Represents a Docker Compose file with properties and configurations for services, networks, volumes, secrets, configs, and custom extensions.
Adds a new config entry to the Compose file.
public sealed class ComposeFile
{
public ComposeFile AddConfig(
Config config)
{
// ...
}
}
configConfigThe config instance to add to the Compose file.
ComposeFileThe updated ComposeFile instance with the added config.
Adds a new network to the Compose file.
public sealed class ComposeFile
{
public ComposeFile AddNetwork(
Network network)
{
// ...
}
}
networkNetworkThe network instance to add to the Compose file.
ComposeFileThe updated ComposeFile instance with the added network.
Adds a new service to the Compose file.
public sealed class ComposeFile
{
public ComposeFile AddService(
Service service)
{
// ...
}
}
serviceServiceThe service instance to add to the Compose file.
ComposeFileThe updated ComposeFile instance containing the added service.
Adds a new volume to the Compose file.
public sealed class ComposeFile
{
public ComposeFile AddVolume(
Volume volume)
{
// ...
}
}
volumeVolumeThe volume instance to add to the Compose file.
ComposeFileThe updated ComposeFile instance with the added volume.
ToYaml(string)Section titled ToYaml(string)string
Converts the current instance of ComposeFile to its YAML string representation.
public sealed class ComposeFile
{
public string ToYaml(
string lineEndings = "\n")
{
// ...
}
}
lineEndingsstringoptionalSpecifies the line endings to be used in the serialized YAML output. Defaults to "\n".
stringA string containing the YAML representation of the ComposeFile instance.