public class RestartPolicy extends Object implements Serializable
Constructor and Description |
---|
RestartPolicy() |
Modifier and Type | Method and Description |
---|---|
static RestartPolicy |
alwaysRestart()
Always restart the container no matter what exit code is returned.
|
Integer |
getMaximumRetryCount() |
String |
getName() |
static RestartPolicy |
noRestart()
Do not restart the container if it dies.
|
static RestartPolicy |
onFailureRestart(int maximumRetryCount)
Restart the container if it exits with a non-zero exit code.
|
static RestartPolicy |
parse(String serialized)
Parses a textual restart polixy specification (as used by the Docker CLI) to a
RestartPolicy . |
String |
toString()
Returns a string representation of this
RestartPolicy . |
static RestartPolicy |
unlessStoppedRestart()
Restart the container unless it has been stopped
|
public static RestartPolicy noRestart()
public static RestartPolicy alwaysRestart()
public static RestartPolicy onFailureRestart(int maximumRetryCount)
maximumRetryCount
- the maximum number of restarts. Set to 0
for unlimited retries.public static RestartPolicy unlessStoppedRestart()
public Integer getMaximumRetryCount()
public String getName()
public static RestartPolicy parse(String serialized) throws IllegalArgumentException
RestartPolicy
.serialized
- the specification, e.g. on-failure:2
RestartPolicy
matching the specificationIllegalArgumentException
- if the specification cannot be parsedpublic String toString()
RestartPolicy
. The format is name[:count]
, like the argument in
parse(String)
.toString
in class Object
RestartPolicy
Copyright © 2021. All rights reserved.