RestartPolicy Properties
Class Properties 4 members
Defines the restart policy for a Docker service in a Swarm cluster.
Specifies the condition under which a service's container will be restarted.
public string? Condition { get; set; }Remarks
This property determines the criteria for restarting a container. Possible values may include "none", "on-failure", or "any", which dictate when a restart should happen (e.g., never, only on failures, or always).
Specifies the delay duration between restart attempts of the service container.
public string? Delay { get; set; }Remarks
The delay defines the time interval to wait before attempting to restart a service container after a failure. It is expressed as a time duration string (e.g., "5s" for 5 seconds).
Specifies the maximum number of restart attempts allowed for a container as part of the restart policy.
public int? MaxAttempts { get; set; }Remarks
Defines the upper limit for how many times Docker will attempt to restart the container before giving up. If not set, the system default behavior or an unlimited restart attempts policy may be applied. This setting is useful for handling scenarios where a service is repeatedly failing and prevents infinite restart loops.
Defines the time window for evaluating the restart conditions in a Docker service restart policy.
public string? Window { get; set; }Remarks
This property specifies the duration (e.g., in seconds or any supported time format) during which restart attempts are counted towards the maximum attempts allowed. If the service exits and restarts within this specified window, it contributes to the count of restart attempts under the restart policy.