summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-07-16 16:38:09 +0200
committerGitHub <noreply@github.com>2019-07-16 16:38:09 +0200
commit386ffd28d64a19a9c244ab477a45c4d2fa239ff6 (patch)
tree3662570d38a80c95841b3bc57606702307234e42 /cmd
parent7e4db4452fdece411e0ee8c7c8805c0c636f49ea (diff)
parent5ed2de158ff8a234f0d5d8380bd44a41c616225c (diff)
downloadpodman-386ffd28d64a19a9c244ab477a45c4d2fa239ff6.tar.gz
podman-386ffd28d64a19a9c244ab477a45c4d2fa239ff6.tar.bz2
podman-386ffd28d64a19a9c244ab477a45c4d2fa239ff6.zip
Merge pull request #3539 from stefanb2/topic-pr-3507-3525
Fix handling of healthcheck from image
Diffstat (limited to 'cmd')
-rw-r--r--cmd/podman/shared/create.go24
1 files changed, 24 insertions, 0 deletions
diff --git a/cmd/podman/shared/create.go b/cmd/podman/shared/create.go
index 17455c4c9..fd319e215 100644
--- a/cmd/podman/shared/create.go
+++ b/cmd/podman/shared/create.go
@@ -115,6 +115,30 @@ func CreateContainer(ctx context.Context, c *GenericCLIResults, runtime *libpod.
if err != nil {
return nil, nil, errors.Wrapf(err, "unable to get healthcheck for %s", c.InputArgs[0])
}
+
+ if healthCheck != nil {
+ hcCommand := healthCheck.Test
+ if len(hcCommand) < 1 || hcCommand[0] == "" || hcCommand[0] == "NONE" {
+ // disable health check
+ healthCheck = nil
+ } else {
+ // apply defaults if image doesn't override them
+ if healthCheck.Interval == 0 {
+ healthCheck.Interval = 30 * time.Second
+ }
+ if healthCheck.Timeout == 0 {
+ healthCheck.Timeout = 30 * time.Second
+ }
+ /* Docker default is 0s, so the following would be a no-op
+ if healthCheck.StartPeriod == 0 {
+ healthCheck.StartPeriod = 0 * time.Second
+ }
+ */
+ if healthCheck.Retries == 0 {
+ healthCheck.Retries = 3
+ }
+ }
+ }
}
}
}