Skip to content
Docs Try Aspire

ComposeFile Methods

Class Methods 5 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)
{
// ...
}
}
config Config The config instance to add to the Compose file.
ComposeFile The updated ComposeFile instance with the added config.
Adds a new network to the Compose file.
public sealed class ComposeFile
{
public ComposeFile AddNetwork(
Network network)
{
// ...
}
}
network Network The network instance to add to the Compose file.
ComposeFile The updated ComposeFile instance with the added network.
Adds a new service to the Compose file.
public sealed class ComposeFile
{
public ComposeFile AddService(
Service service)
{
// ...
}
}
service Service The service instance to add to the Compose file.
ComposeFile The updated ComposeFile instance containing the added service.
Adds a new volume to the Compose file.
public sealed class ComposeFile
{
public ComposeFile AddVolume(
Volume volume)
{
// ...
}
}
volume Volume The volume instance to add to the Compose file.
ComposeFile The 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")
{
// ...
}
}
lineEndings string optional Specifies the line endings to be used in the serialized YAML output. Defaults to "\n".
string A string containing the YAML representation of the ComposeFile instance.