Skip to content

Commit

Permalink
fix parsing of repository:tag
Browse files Browse the repository at this point in the history
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
  • Loading branch information
ndeloof committed Dec 13, 2022
1 parent 3ee2ab8 commit 4f81631
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions pkg/compose/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 4f81631

Please sign in to comment.