Search code examples
docker

Can a Docker image have more than one digest?


I notice that when I use docker inspect image someimage, the RepoDigests value is an array rather than just a string. Is there some situation where an image can have more than one digest?


Solution

  • There may be a digest for the multi-platform manifest (a listing for all the platform specific images), this is what docker shows by default to make multi-platform support easier. There could be a second entry for the platform specific image. And if you push/pull the image to/from other registries you'll also see those locations listed in the array (commonly seen when you have a local registry with a copy of upstream base images).

    Historically it's also possible to pull an image with an old manifest schema and docker would push with a different schema, changing the digest. And if you pull+tag+push to copy your image to another registry, it's possible for the digest to change because tooling that generated the manifest may be different (there are multiple media types for the image manifest, and serializing the JSON can reorder/add/remove fields or change the white spacing).

    Without using containerd to directly manage the images (currently experimental), one pulled image will not have multiple platforms. Docker dereferences the the multi-platform manifest to your local platform and only pulls that single image.