소스 검색

c8d/list: Show layerless images

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
Paweł Gronowski 2 년 전
부모
커밋
34964c2454
1개의 변경된 파일4개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      daemon/containerd/image_list.go

+ 4 - 1
daemon/containerd/image_list.go

@@ -524,9 +524,12 @@ func getManifestPlatform(ctx context.Context, store content.Provider, manifestDe
 	return platforms.Normalize(platform), nil
 	return platforms.Normalize(platform), nil
 }
 }
 
 
-// isImageManifest returns true if the manifest has any layer that is a known image layer.
+// isImageManifest returns true if the manifest has no layers or any of its layers is a known image layer.
 // Some manifests use the image media type for compatibility, even if they are not a real image.
 // Some manifests use the image media type for compatibility, even if they are not a real image.
 func isImageManifest(mfst ocispec.Manifest) bool {
 func isImageManifest(mfst ocispec.Manifest) bool {
+	if len(mfst.Layers) == 0 {
+		return true
+	}
 	for _, l := range mfst.Layers {
 	for _, l := range mfst.Layers {
 		if images.IsLayerType(l.MediaType) {
 		if images.IsLayerType(l.MediaType) {
 			return true
 			return true