summaryrefslogtreecommitdiff
path: root/cmd/podman
diff options
context:
space:
mode:
authorStefan Becker <chemobejk@gmail.com>2019-07-10 08:40:58 +0300
committerStefan Becker <chemobejk@gmail.com>2019-07-16 07:01:43 +0300
commit5caf218b1162d6b24ac898b0e8ff730f5dcafe23 (patch)
treec73022213e7f07b9ee0075a85731ee89cbf30fd7 /cmd/podman
parent33001a9028d0ad12d2992dda295fd570714ca237 (diff)
downloadpodman-5caf218b1162d6b24ac898b0e8ff730f5dcafe23.tar.gz
podman-5caf218b1162d6b24ac898b0e8ff730f5dcafe23.tar.bz2
podman-5caf218b1162d6b24ac898b0e8ff730f5dcafe23.zip
create: ignore check if image has HEALTHCHECK NONE
If the image was built with "HEALTHCHECK NONE" then we should create a container without healthcheck configuration. Otherwise executing the healthcheck on the container will return "unhealthy" instead of the correct error message that the container doesn't have a healthcheck. We also ignore the healthcheck configuration if the command list is empty or the command string is empty. Fixes #3525 Signed-off-by: Stefan Becker <chemobejk@gmail.com>
Diffstat (limited to 'cmd/podman')
-rw-r--r--cmd/podman/shared/create.go34
1 files changed, 20 insertions, 14 deletions
diff --git a/cmd/podman/shared/create.go b/cmd/podman/shared/create.go
index 9ce20047b..fd319e215 100644
--- a/cmd/podman/shared/create.go
+++ b/cmd/podman/shared/create.go
@@ -117,20 +117,26 @@ func CreateContainer(ctx context.Context, c *GenericCLIResults, runtime *libpod.
}
if healthCheck != nil {
- // 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
+ 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
+ }
}
}
}