Merge pull request #6522 from mheon/unless-stopped

Add support for the unless-stopped restart policy
This commit is contained in:
OpenShift Merge Robot
2020-06-17 15:25:09 -04:00
committed by GitHub
6 changed files with 24 additions and 10 deletions

View File

@ -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.

View File

@ -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)