mirror of
https://github.com/containers/podman.git
synced 2025-06-23 18:59:30 +08:00
Merge pull request #6522 from mheon/unless-stopped
Add support for the unless-stopped restart policy
This commit is contained in:
@ -97,6 +97,10 @@ const (
|
||||
// RestartPolicyOnFailure restarts the container on non-0 exit code,
|
||||
// with an optional maximum number of retries.
|
||||
RestartPolicyOnFailure = "on-failure"
|
||||
// RestartPolicyUnlessStopped unconditionally restarts unless stopped
|
||||
// by the user. It is identical to Always except with respect to
|
||||
// handling of system restart, which Podman does not yet support.
|
||||
RestartPolicyUnlessStopped = "unless-stopped"
|
||||
)
|
||||
|
||||
// Container is a single OCI container.
|
||||
|
@ -1285,7 +1285,7 @@ func WithRestartPolicy(policy string) CtrCreateOption {
|
||||
}
|
||||
|
||||
switch policy {
|
||||
case RestartPolicyNone, RestartPolicyNo, RestartPolicyOnFailure, RestartPolicyAlways:
|
||||
case RestartPolicyNone, RestartPolicyNo, RestartPolicyOnFailure, RestartPolicyAlways, RestartPolicyUnlessStopped:
|
||||
ctr.config.RestartPolicy = policy
|
||||
default:
|
||||
return errors.Wrapf(define.ErrInvalidArg, "%q is not a valid restart policy", policy)
|
||||
|
Reference in New Issue
Block a user