Share via


ComposeFile Class

Definition

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

[YamlDotNet.Serialization.YamlSerializable]
public sealed class ComposeFile
[<YamlDotNet.Serialization.YamlSerializable>]
type ComposeFile = class
Public NotInheritable Class ComposeFile
Inheritance
ComposeFile
Attributes
YamlDotNet.Serialization.YamlSerializableAttribute

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.

Constructors

ComposeFile()

Properties

Configs

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.

Extensions

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.

Name

Represents the name of the Docker Compose file or project.

Networks

Represents the collection of networks defined in a Docker Compose file.

Secrets

Represents the secrets section in a Docker Compose file. Contains a collection of secret definitions used within the Compose file.

Services

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.

Version

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.

Volumes

Represents a collection of volume definitions within a Docker Compose file.

Methods

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)

Converts the current instance of ComposeFile to its YAML string representation.

Applies to