Skip to content

Commit

Permalink
Support for podman local images (#1969)
Browse files Browse the repository at this point in the history
* Updating GetCanonicalImageName to construct compatible image names for local podman images

* Fixing comment formatting

---------

Co-authored-by: Andrew Redmon <auggiedog@gmail.com>
  • Loading branch information
aredmon85 and Andrew Redmon committed Apr 4, 2024
1 parent 85bda39 commit c91169b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions utils/containers.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ func GetCanonicalImageName(imageName string) string {
// alpine == docker.io/library/alpine:latest
// foo/bar == docker.io/foo/bar:latest
// foo.bar/baz == foo.bar/bar:latest
// localhost/foo:bar == localhost/foo:bar
// docker.elastic.co/elasticsearch/elasticsearch == docker.elastic.co/elasticsearch/elasticsearch:latest
canonicalImageName := imageName
slashCount := strings.Count(imageName, "/")
Expand All @@ -32,6 +33,9 @@ func GetCanonicalImageName(imageName string) string {
// case of foo.bar/baz
if strings.Contains(nameSplit[0], ".") {
canonicalImageName = imageName
} else if strings.Contains(nameSplit[0], "localhost") {
// case of localhost/foo:bar - podman prefixes local images with "localhost"
canonicalImageName = imageName
} else {
canonicalImageName = "docker.io/" + imageName
}
Expand Down

0 comments on commit c91169b

Please sign in to comment.