diff options
author | Aditya R <arajan@redhat.com> | 2022-04-20 16:12:41 +0530 |
---|---|---|
committer | Aditya R <arajan@redhat.com> | 2022-04-20 16:12:45 +0530 |
commit | 519535daa0e5c4ce27a77cea0fb24d87f6ee8c54 (patch) | |
tree | 98a4c53a2b4b535be9ed729a2ea54df6be17c8d7 /pkg/specgen | |
parent | bc8d8737b760a1f42a9208c6067d2e163817d5f0 (diff) | |
download | podman-519535daa0e5c4ce27a77cea0fb24d87f6ee8c54.tar.gz podman-519535daa0e5c4ce27a77cea0fb24d87f6ee8c54.tar.bz2 podman-519535daa0e5c4ce27a77cea0fb24d87f6ee8c54.zip |
healthcheck: set default healthcheck Interval if not specified in image
Set appropriate defaults for `--interval` when
processing a Containerfile with build format as docker.
Signed-off-by: Aditya R <arajan@redhat.com>
Diffstat (limited to 'pkg/specgen')
-rw-r--r-- | pkg/specgen/generate/container.go | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/pkg/specgen/generate/container.go b/pkg/specgen/generate/container.go index f7ea2edfa..5f4218899 100644 --- a/pkg/specgen/generate/container.go +++ b/pkg/specgen/generate/container.go @@ -67,12 +67,21 @@ func CompleteSpec(ctx context.Context, r *libpod.Runtime, s *specgen.SpecGenerat // NOTE: the health check is only set for Docker images // but inspect will take care of it. s.HealthConfig = inspectData.HealthCheck - if s.HealthConfig != nil && s.HealthConfig.Timeout == 0 { - hct, err := time.ParseDuration(define.DefaultHealthCheckTimeout) - if err != nil { - return nil, err + if s.HealthConfig != nil { + if s.HealthConfig.Timeout == 0 { + hct, err := time.ParseDuration(define.DefaultHealthCheckTimeout) + if err != nil { + return nil, err + } + s.HealthConfig.Timeout = hct + } + if s.HealthConfig.Interval == 0 { + hct, err := time.ParseDuration(define.DefaultHealthCheckInterval) + if err != nil { + return nil, err + } + s.HealthConfig.Interval = hct } - s.HealthConfig.Timeout = hct } } |