mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-19 09:16:29 +00:00
Merge pull request #4018 from christoph-zededa/fix_pulling_from_localhost_registry
util: allow pulling from local registry
This commit is contained in:
commit
3ff5dac063
@ -1,6 +1,8 @@
|
|||||||
package util
|
package util
|
||||||
|
|
||||||
import "strings"
|
import (
|
||||||
|
"strings"
|
||||||
|
)
|
||||||
|
|
||||||
type refOpts struct {
|
type refOpts struct {
|
||||||
withTag bool
|
withTag bool
|
||||||
@ -21,16 +23,13 @@ func ReferenceExpand(ref string, options ...ReferenceOption) string {
|
|||||||
for _, opt := range options {
|
for _, opt := range options {
|
||||||
opt(&opts)
|
opt(&opts)
|
||||||
}
|
}
|
||||||
var ret string
|
ret := ref
|
||||||
|
|
||||||
parts := strings.Split(ref, "/")
|
parts := strings.Split(ref, "/")
|
||||||
switch len(parts) {
|
if len(parts) == 1 {
|
||||||
case 1:
|
|
||||||
ret = "docker.io/library/" + ref
|
ret = "docker.io/library/" + ref
|
||||||
case 2:
|
|
||||||
ret = "docker.io/" + ref
|
|
||||||
default:
|
|
||||||
ret = ref
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if opts.withTag && !strings.Contains(ret, ":") {
|
if opts.withTag && !strings.Contains(ret, ":") {
|
||||||
ret += ":latest"
|
ret += ":latest"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user