Skip to content

Commit

Permalink
check image media/manifest type for healthchecks
Browse files Browse the repository at this point in the history
before looking up a healthcheck in an image, check to make sure it is a dockerv2schema image.

Signed-off-by: Brent Baude <[email protected]>
  • Loading branch information
baude authored and snj33v committed May 31, 2020
1 parent b6d2f03 commit fde95a2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/specgen/generate/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down

0 comments on commit fde95a2

Please sign in to comment.