Skip to content

Commit d36732a

Browse files
committed
debug
Signed-off-by: ChengyuZhu6 <hudson@cyzhu.com>
1 parent a49ea0a commit d36732a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

pkg/imgutil/transfer.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"errors"
2222
"fmt"
2323
"io"
24+
"net"
2425
"net/http"
2526
"os"
2627

@@ -91,7 +92,12 @@ func createOCIRegistry(ctx context.Context, parsedReference *referenceutil.Image
9192
opts = append(opts, registry.WithHostDir(gOptions.HostsDir[0]))
9293
}
9394

94-
if isLocalHost, err := docker.MatchLocalhost(parsedReference.Domain); err != nil {
95+
hostname, _, err := net.SplitHostPort(parsedReference.Domain)
96+
if err != nil {
97+
hostname = parsedReference.Domain
98+
}
99+
100+
if isLocalHost, err := docker.MatchLocalhost(hostname); err != nil {
95101
cleanup()
96102
return nil, nil, err
97103
} else if isLocalHost || plainHTTP {
@@ -136,6 +142,7 @@ func PullImageWithTransfer(ctx context.Context, client *containerd.Client, parse
136142
defer cleanup2()
137143
transferErr = doTransfer(ctx, client, fetcher, store, options.Quiet, progressWriter)
138144
}
145+
log.G(ctx).Info("Hint: you may want to try --insecure-registry to allow plain HTTP (if you are in a trusted network)")
139146
}
140147

141148
if transferErr != nil {

0 commit comments

Comments
 (0)