diff --git a/frontend/dockerui/build.go b/frontend/dockerui/build.go index 701daa18cd8a..8fc9bbbff11e 100644 --- a/frontend/dockerui/build.go +++ b/frontend/dockerui/build.go @@ -50,6 +50,17 @@ func (bc *Client) Build(ctx context.Context, fn BuildFunc) (*ResultBuilder, erro if tp != nil { p = *tp } + + // in certain conditions we allow input platform to be extended from base image + if p.OS == "windows" && img.OS == p.OS { + if p.OSVersion == "" && img.OSVersion != "" { + p.OSVersion = img.OSVersion + } + if p.OSFeatures == nil && len(img.OSFeatures) > 0 { + p.OSFeatures = img.OSFeatures + } + } + p = platforms.Normalize(p) k := platforms.Format(p)