Share via


RestartPolicy.MaxAttempts Property

Definition

Specifies the maximum number of restart attempts allowed for a container as part of the restart policy.

[YamlDotNet.Serialization.YamlMember(Alias="max_attempts")]
public int? MaxAttempts { get; set; }
[<YamlDotNet.Serialization.YamlMember(Alias="max_attempts")>]
member this.MaxAttempts : Nullable<int> with get, set
Public Property MaxAttempts As Nullable(Of Integer)

Property Value

Attributes
YamlDotNet.Serialization.YamlMemberAttribute

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.

Applies to