From 05e987dd0a71f062c45624ccc79e835f534b63d9 Mon Sep 17 00:00:00 2001 From: Nicolas De Loof Date: Tue, 13 Dec 2022 11:12:09 +0100 Subject: [PATCH] fix parsing of repository:tag Signed-off-by: Nicolas De Loof --- pkg/compose/images.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pkg/compose/images.go b/pkg/compose/images.go index 7c25b20de..cef8b4fa1 100644 --- a/pkg/compose/images.go +++ b/pkg/compose/images.go @@ -22,6 +22,7 @@ import ( "strings" "sync" + "github.com/distribution/distribution/v3/reference" moby "github.com/docker/docker/api/types" "github.com/docker/docker/api/types/filters" "github.com/docker/docker/errdefs" @@ -94,10 +95,13 @@ func (s *composeService) getImages(ctx context.Context, images []string) (map[st tag := "" repository := "" if len(inspect.RepoTags) > 0 { - repotag := strings.Split(inspect.RepoTags[0], ":") - repository = repotag[0] - if len(repotag) > 1 { - tag = repotag[1] + ref, err := reference.ParseDockerRef(inspect.RepoTags[0]) + if err != nil { + return err + } + repository = reference.FamiliarName(ref) + if tagged, ok := ref.(reference.Tagged); ok { + tag = tagged.Tag() } } l.Lock()