mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #23232 from thaJeztah/update-default-retries
Healthcheck: set default retries to 3
This commit is contained in:
commit
3db23a4eaf
4 changed files with 8 additions and 4 deletions
|
@ -2,7 +2,7 @@ FROM debian
|
||||||
ADD check.sh main.sh /app/
|
ADD check.sh main.sh /app/
|
||||||
CMD /app/main.sh
|
CMD /app/main.sh
|
||||||
HEALTHCHECK
|
HEALTHCHECK
|
||||||
HEALTHCHECK --interval=5s --timeout=3s --retries=1 \
|
HEALTHCHECK --interval=5s --timeout=3s --retries=3 \
|
||||||
CMD /app/check.sh --quiet
|
CMD /app/check.sh --quiet
|
||||||
HEALTHCHECK CMD
|
HEALTHCHECK CMD
|
||||||
HEALTHCHECK CMD a b
|
HEALTHCHECK CMD a b
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
(add "check.sh" "main.sh" "/app/")
|
(add "check.sh" "main.sh" "/app/")
|
||||||
(cmd "/app/main.sh")
|
(cmd "/app/main.sh")
|
||||||
(healthcheck)
|
(healthcheck)
|
||||||
(healthcheck ["--interval=5s" "--timeout=3s" "--retries=1"] "CMD" "/app/check.sh --quiet")
|
(healthcheck ["--interval=5s" "--timeout=3s" "--retries=3"] "CMD" "/app/check.sh --quiet")
|
||||||
(healthcheck "CMD")
|
(healthcheck "CMD")
|
||||||
(healthcheck "CMD" "a b")
|
(healthcheck "CMD" "a b")
|
||||||
(healthcheck ["--timeout=3s"] "CMD" "foo")
|
(healthcheck ["--timeout=3s"] "CMD" "foo")
|
||||||
|
|
|
@ -28,6 +28,10 @@ const (
|
||||||
// than this, the check is considered to have failed.
|
// than this, the check is considered to have failed.
|
||||||
defaultProbeTimeout = 30 * time.Second
|
defaultProbeTimeout = 30 * time.Second
|
||||||
|
|
||||||
|
// Default number of consecutive failures of the health check
|
||||||
|
// for the container to be considered unhealthy.
|
||||||
|
defaultProbeRetries = 3
|
||||||
|
|
||||||
// Shut down a container if it becomes Unhealthy.
|
// Shut down a container if it becomes Unhealthy.
|
||||||
defaultExitOnUnhealthy = true
|
defaultExitOnUnhealthy = true
|
||||||
|
|
||||||
|
@ -111,7 +115,7 @@ func handleProbeResult(d *Daemon, c *container.Container, result *types.Healthch
|
||||||
|
|
||||||
retries := c.Config.Healthcheck.Retries
|
retries := c.Config.Healthcheck.Retries
|
||||||
if retries <= 0 {
|
if retries <= 0 {
|
||||||
retries = 1 // Default if unset or set to an invalid value
|
retries = defaultProbeRetries
|
||||||
}
|
}
|
||||||
|
|
||||||
h := c.State.Health
|
h := c.State.Health
|
||||||
|
|
|
@ -1496,7 +1496,7 @@ The options that can appear before `CMD` are:
|
||||||
|
|
||||||
* `--interval=DURATION` (default: `30s`)
|
* `--interval=DURATION` (default: `30s`)
|
||||||
* `--timeout=DURATION` (default: `30s`)
|
* `--timeout=DURATION` (default: `30s`)
|
||||||
* `--retries=N` (default: `1`)
|
* `--retries=N` (default: `3`)
|
||||||
|
|
||||||
The health check will first run **interval** seconds after the container is
|
The health check will first run **interval** seconds after the container is
|
||||||
started, and then again **interval** seconds after each previous check completes.
|
started, and then again **interval** seconds after each previous check completes.
|
||||||
|
|
Loading…
Reference in a new issue