I've read through related questions, and also Google's own statement on the definition of Digest in an OCI container image (e.g. as used with docker or podman):
"The image digest is the hash of the image index or image manifest JSON document."
But for those of us who aren't experts on the internals, I'd appreciate a straightforward yes or no on whether this means any modification to the content would produce a different digest. Excluding the extremely unlikely possibility of a hash collision, that is.
Good evidence of this might include an explanation that the "image index" or "image manifest" is itself guaranteed to contain a sha256 hash of the actual contents of the image, or similar, and therefore the contents of the image (e.g. the actual files in it) definitely contribute to the uniqueness of the digest.
Yes, the digest of a container image is the hash of the root node of a Merkle tree. The hash of every element in that Merkle tree is a content addressable hash (a hash of its content). That image manifest contains the hashes of the image config (describing features like the command to run, environment variables, labels, etc) and an ordered list of image layers (each of those a tar filesystem diff).
More details of this structure are described in the OCI image-spec.
An example of this could look at an existing image. First the digest can be retrieved, and shown to match the sha256sum of the body of the manifest, which in this case is a multi-platform index manifest:
Each entry in the index is a descriptor with a digest to a child manifest, in this case the image manifest with descriptors to the config and layers:
The image config is JSON data about the image:
Pulling a (smaller) layer, first to verify the digest is content addressable, and then running it through tar to show the contents of the layer:
Changing any of the child content would change its content addressable hash, which would change the reference to that content in the parent manifest, which would change the digest of that parent manifest.