summaryrefslogtreecommitdiff
path: root/pkg/specgen
diff options
context:
space:
mode:
authorBrent Baude <bbaude@redhat.com>2020-04-28 11:49:58 -0500
committerBrent Baude <bbaude@redhat.com>2020-04-28 11:49:58 -0500
commita255075fe8825844f484981c77bb5e59b202a1e9 (patch)
tree2f2ebf2426a3897116259c2bacbf284591fb4146 /pkg/specgen
parentf079b4ee5ea9673f8697fbf9120ff24b4f16b07f (diff)
downloadpodman-a255075fe8825844f484981c77bb5e59b202a1e9.tar.gz
podman-a255075fe8825844f484981c77bb5e59b202a1e9.tar.bz2
podman-a255075fe8825844f484981c77bb5e59b202a1e9.zip
check image media/manifest type for healthchecks
before looking up a healthcheck in an image, check to make sure it is a dockerv2schema image. Signed-off-by: Brent Baude <bbaude@redhat.com>
Diffstat (limited to 'pkg/specgen')
-rw-r--r--pkg/specgen/generate/container.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/pkg/specgen/generate/container.go b/pkg/specgen/generate/container.go
index b27dd1cc2..76665f9fc 100644
--- a/pkg/specgen/generate/container.go
+++ b/pkg/specgen/generate/container.go
@@ -3,6 +3,7 @@ package generate
import (
"context"
+ "github.com/containers/image/v5/manifest"
"github.com/containers/libpod/libpod"
ann "github.com/containers/libpod/pkg/annotations"
envLib "github.com/containers/libpod/pkg/env"
@@ -22,7 +23,12 @@ func CompleteSpec(ctx context.Context, r *libpod.Runtime, s *specgen.SpecGenerat
return err
}
- if s.HealthConfig == nil {
+ _, mediaType, err := newImage.Manifest(ctx)
+ if err != nil {
+ return err
+ }
+
+ if s.HealthConfig == nil && mediaType == manifest.DockerV2Schema2MediaType {
s.HealthConfig, err = newImage.GetHealthCheck(ctx)
if err != nil {
return err