瀏覽代碼

fix buildkit pull nil panic

Signed-off-by: Wang Yumu <37442693@qq.com>
Wang Yumu 5 年之前
父節點
當前提交
2b22a2e792
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      builder/builder-next/adapters/containerimage/pull.go

+ 1 - 1
builder/builder-next/adapters/containerimage/pull.go

@@ -151,7 +151,7 @@ func (is *Source) ResolveImageConfig(ctx context.Context, ref string, opt llb.Re
 	case source.ResolveModePreferLocal:
 	case source.ResolveModePreferLocal:
 		img, err := is.resolveLocal(ref)
 		img, err := is.resolveLocal(ref)
 		if err == nil {
 		if err == nil {
-			if !platformMatches(img, opt.Platform) {
+			if opt.Platform != nil && !platformMatches(img, opt.Platform) {
 				logrus.WithField("ref", ref).Debugf("Requested build platform %s does not match local image platform %s, checking remote",
 				logrus.WithField("ref", ref).Debugf("Requested build platform %s does not match local image platform %s, checking remote",
 					path.Join(opt.Platform.OS, opt.Platform.Architecture, opt.Platform.Variant),
 					path.Join(opt.Platform.OS, opt.Platform.Architecture, opt.Platform.Variant),
 					path.Join(img.OS, img.Architecture, img.Variant),
 					path.Join(img.OS, img.Architecture, img.Variant),