瀏覽代碼

Windows: Block (v2) pulling Linux images

Signed-off-by: John Howard <jhoward@microsoft.com>
John Howard 9 年之前
父節點
當前提交
4e3d7ca4ae
共有 1 個文件被更改,包括 5 次插入0 次删除
  1. 5 0
      distribution/pull_v2.go

+ 5 - 0
distribution/pull_v2.go

@@ -550,6 +550,11 @@ func (p *v2Puller) pullSchema2(ctx context.Context, ref reference.Named, mfst *s
 		if unmarshalledConfig.RootFS == nil {
 		if unmarshalledConfig.RootFS == nil {
 			return "", "", errors.New("image config has no rootfs section")
 			return "", "", errors.New("image config has no rootfs section")
 		}
 		}
+		// https://github.com/docker/docker/issues/24766 - Err on the side of caution,
+		// explicitly blocking images intended for linux from the Windows daemon
+		if unmarshalledConfig.OS == "linux" {
+			return "", "", fmt.Errorf("image operating system %q cannot be used on this platform", unmarshalledConfig.OS)
+		}
 		downloadRootFS = *unmarshalledConfig.RootFS
 		downloadRootFS = *unmarshalledConfig.RootFS
 		downloadRootFS.DiffIDs = []layer.DiffID{}
 		downloadRootFS.DiffIDs = []layer.DiffID{}
 	} else {
 	} else {