Handle digest based image reference (#335)

Co-authored-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
CrazyMax
2021-04-25 00:28:20 +02:00
committed by GitHub
parent b7d9265df4
commit 9b4e62474b
5 changed files with 160 additions and 37 deletions

View File

@@ -6,12 +6,10 @@ import (
"strings"
"github.com/crazy-max/diun/v4/internal/model"
"github.com/rs/zerolog/log"
)
// ValidateContainerImage returns a standard image through Docker labels
func ValidateContainerImage(image string, labels map[string]string, watchByDef bool) (img model.Image, err error) {
log.Debug().Msgf("Validating %s", image)
// ValidateImage returns a standard image through Docker labels
func ValidateImage(image string, labels map[string]string, watchByDef bool) (img model.Image, err error) {
if i := strings.Index(image, "@sha256:"); i > 0 {
image = image[:i]
}