Browse code

fix buildkit pull nil panic

Signed-off-by: Wang Yumu <37442693@qq.com>

Wang Yumu authored on 2020/07/29 08:48:50
Showing 1 changed files
... ...
@@ -151,7 +151,7 @@ func (is *Source) ResolveImageConfig(ctx context.Context, ref string, opt llb.Re
151 151
 	case source.ResolveModePreferLocal:
152 152
 		img, err := is.resolveLocal(ref)
153 153
 		if err == nil {
154
-			if !platformMatches(img, opt.Platform) {
154
+			if opt.Platform != nil && !platformMatches(img, opt.Platform) {
155 155
 				logrus.WithField("ref", ref).Debugf("Requested build platform %s does not match local image platform %s, checking remote",
156 156
 					path.Join(opt.Platform.OS, opt.Platform.Architecture, opt.Platform.Variant),
157 157
 					path.Join(img.OS, img.Architecture, img.Variant),