mirror of
https://github.com/docker/docs.git
synced 2026-03-27 14:28:47 +07:00
engine: clarify on-failure restart policy with daemon restart
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
This commit is contained in:
@@ -24,12 +24,12 @@ To configure the restart policy for a container, use the `--restart` flag
|
||||
when using the `docker run` command. The value of the `--restart` flag can be
|
||||
any of the following:
|
||||
|
||||
| Flag | Description |
|
||||
| :------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `no` | Don't automatically restart the container. (Default) |
|
||||
| `on-failure[:max-retries]` | Restart the container if it exits due to an error, which manifests as a non-zero exit code. Optionally, limit the number of times the Docker daemon attempts to restart the container using the `:max-retries` option. |
|
||||
| `always` | Always restart the container if it stops. If it's manually stopped, it's restarted only when Docker daemon restarts or the container itself is manually restarted. (See the second bullet listed in [restart policy details](#restart-policy-details)) |
|
||||
| `unless-stopped` | Similar to `always`, except that when the container is stopped (manually or otherwise), it isn't restarted even after Docker daemon restarts. |
|
||||
| Flag | Description |
|
||||
| :------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `no` | Don't automatically restart the container. (Default) |
|
||||
| `on-failure[:max-retries]` | Restart the container if it exits due to an error, which manifests as a non-zero exit code. Optionally, limit the number of times the Docker daemon attempts to restart the container using the `:max-retries` option. The `on-failure` policy only prompts a restart if the container exits with a failure. It doesn't restart the container if the daemon restarts. |
|
||||
| `always` | Always restart the container if it stops. If it's manually stopped, it's restarted only when Docker daemon restarts or the container itself is manually restarted. (See the second bullet listed in [restart policy details](#restart-policy-details)) |
|
||||
| `unless-stopped` | Similar to `always`, except that when the container is stopped (manually or otherwise), it isn't restarted even after Docker daemon restarts. |
|
||||
|
||||
The following command starts a Redis container and configures it to always
|
||||
restart, unless the container is explicitly stopped, or the daemon restarts.
|
||||
|
||||
Reference in New Issue
Block a user