Skip to content

Commit

Permalink
Merge pull request linuxkit#4018 from christoph-zededa/fix_pulling_fr…
Browse files Browse the repository at this point in the history
…om_localhost_registry

util: allow pulling from local registry
  • Loading branch information
deitch authored Mar 17, 2024
2 parents 1b1007a + 4496612 commit 3ff5dac
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/cmd/linuxkit/util/reference.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package util

import "strings"
import (
"strings"
)

type refOpts struct {
withTag bool
Expand All @@ -21,16 +23,13 @@ func ReferenceExpand(ref string, options ...ReferenceOption) string {
for _, opt := range options {
opt(&opts)
}
var ret string
ret := ref

parts := strings.Split(ref, "/")
switch len(parts) {
case 1:
if len(parts) == 1 {
ret = "docker.io/library/" + ref
case 2:
ret = "docker.io/" + ref
default:
ret = ref
}

if opts.withTag && !strings.Contains(ret, ":") {
ret += ":latest"
}
Expand Down

0 comments on commit 3ff5dac

Please sign in to comment.