mirror of
https://github.com/containers/podman.git
synced 2025-05-20 08:36:23 +08:00
Add support for the unless-stopped restart policy
We initially believed that implementing this required support for restarting containers after reboot, but this is not the case. The unless-stopped restart policy acts identically to the always restart policy except in cases related to reboot (which we do not support yet), but it does not require that support for us to implement it. Changes themselves are quite simple, we need a new restart policy constant, we need to remove existing checks that block creation of containers when unless-stopped was used, and we need to update the manpages. Fixes #6508 Signed-off-by: Matthew Heon <matthew.heon@pm.me>
This commit is contained in:

committed by
Matthew Heon

parent
1acd2adccb
commit
6f1440a3ec
@ -676,6 +676,7 @@ Valid values are:
|
||||
- `no` : Do not restart containers on exit
|
||||
- `on-failure[:max_retries]` : Restart containers when they exit with a non-0 exit code, retrying indefinitely or until the optional max_retries count is hit
|
||||
- `always` : Restart containers when they exit, regardless of status, retrying indefinitely
|
||||
- `unless-stopped` : Identical to **always**
|
||||
|
||||
Please note that restart will not restart containers after a system reboot.
|
||||
If this functionality is required in your environment, you can invoke Podman from a systemd unit file, or create an init script for whichever init system is in use.
|
||||
|
@ -682,11 +682,10 @@ Restart policy will not take effect if a container is stopped via the **podman k
|
||||
|
||||
Valid _policy_ values are:
|
||||
|
||||
- **no**: Do not restart containers on exit;
|
||||
- **on-failure**[:*max_retries*]: Restart containers when they exit
|
||||
with a non-zero exit code, retrying indefinitely or until the optional
|
||||
*max_retries* count is hit;
|
||||
- **always**: Restart containers when they exit, regardless of status, retrying indefinitely.
|
||||
- `no` : Do not restart containers on exit
|
||||
- `on-failure[:max_retries]` : Restart containers when they exit with a non-zero exit code, retrying indefinitely or until the optional *max_retries* count is hit
|
||||
- `always` : Restart containers when they exit, regardless of status, retrying indefinitely
|
||||
- `unless-stopped` : Identical to **always**
|
||||
|
||||
Please note that restart will not restart containers after a system reboot.
|
||||
If this functionality is required in your environment, you can invoke Podman from a **systemd.unit**(5) file, or create an init script for whichever init system is in use.
|
||||
|
Reference in New Issue
Block a user