Skip to content

Commit

Permalink
c8d/list: Handle unpacked layers when calculating shared size
Browse files Browse the repository at this point in the history
After a535a65 the size reported by the
image list was changed to include all platforms of that image.

This made the "shared size" calculation consider all diff ids of all the
platforms available in the image which caused "snapshot not found"
errors when multiple images were sharing the same layer which wasn't
unpacked. This could happen frequently because by default only the host
platform is unpacked for pulled images.

This was could be reproduced with:
```
$ docker pull docker.io/docker/desktop-kubernetes-coredns:v1.11.1
$ docker pull docker.io/docker/desktop-kubernetes-etcd:3.5.10-0
$ docker system df
```

Which is broken before this commit.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
  • Loading branch information
vvoland committed Mar 19, 2024
1 parent 4531a37 commit 26efc64
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions daemon/containerd/image_list.go
Expand Up @@ -650,6 +650,11 @@ func computeSharedSize(chainIDs []digest.Digest, layers map[digest.Digest]int, s
}
size, err := sizeFn(chainID)
if err != nil {
// Several images might share the same layer and neither of them
// might be unpacked (for example if it's a non-host platform).
if cerrdefs.IsNotFound(err) {
continue
}
return 0, err
}
sharedSize += size
Expand Down

0 comments on commit 26efc64

Please sign in to comment.