Complete docs for "restart: on-failure" in "Compose file reference / Services top-level element" (#19116)

* Complete docs for "restart: on-failure" in "Compose file reference / Services top-level element"

* Fix link: /engine/reference/run/#restart-policies---restart

* remove "The default number of restart retries is 1."
This commit is contained in:
Valeriy 2024-01-17 10:17:24 +01:00 committed by GitHub
parent f17281ab38
commit 7064a49f06
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 1 deletions

View File

@ -1483,7 +1483,8 @@ If `pull_policy` and `build` are both present, Compose builds the image by defau
- `no`: The default restart policy. It does not restart the container under any circumstances.
- `always`: The policy always restarts the container until its removal.
- `on-failure`: The policy restarts the container if the exit code indicates an error.
- `on-failure[:max-retries]`: The policy restarts the container if the exit code indicates an error.
Optionally, limit the number of restart retries the Docker daemon attempts.
- `unless-stopped`: The policy restarts the container irrespective of the exit code but stops
restarting when the service is stopped or removed.
@ -1491,9 +1492,14 @@ If `pull_policy` and `build` are both present, Compose builds the image by defau
restart: "no"
restart: always
restart: on-failure
restart: on-failure:3
restart: unless-stopped
```
You can find more detailed information on restart policies in the
[Restart Policies (--restart)](/engine/reference/run/#restart-policies---restart)
section of the Docker run reference page.
## runtime
`runtime` specifies which runtime to use for the services containers.