Service Methods
Class Methods 4 members
Represents a Docker Compose service definition.
Adds a configuration reference to the service's list of configurations. This method allows you to include external configuration resources that the service can utilize at runtime.
public sealed class Service{ public Service AddConfig( ConfigReference config) { // ... }}Parameters
config ConfigReference The config reference to add AddEnvironmentalVariable(string, string?) Section titled AddEnvironmentalVariable(string, string?) Service Adds an environmental variable to the service's environment dictionary. If the specified value is null, it assigns an empty string as the value.
public sealed class Service{ public Service AddEnvironmentalVariable( string key, string? value) { // ... }}Parameters
key string The key for the environmental variable. value string? The value of the environmental variable. If null, an empty string will be used. Adds a volume to the service's list of volumes. If the volumes collection is null, it initializes a new collection before adding the volume.
public sealed class Service{ public Service AddVolume( Volume volume) { // ... }}Parameters
volume Volume The volume to be added to the service. Adds multiple volumes to the service's list of volumes. If the volumes collection is empty, the provided volumes will be appended to the existing collection.
public sealed class Service{ public Service AddVolumes( IEnumerable<Volume> volumes) { // ... }}Parameters
volumes IEnumerable<Volume> A collection of volumes to be added to the service.