Skip to content

ImageID: allow hashing index instead of config #1333

Description

@AkihiroSuda

image-spec/config.md

Lines 85 to 89 in af26a05

### ImageID
Each image's ID is given by the SHA256 hash of its [configuration JSON](#image-json).
It is represented as a hexadecimal encoding of 256 bits, e.g., `sha256:a9561eb1b190625c9adb5a9513e72c4dedafc1cb2d4c5236c9a6957ec7dfd5a9`.
Since the [configuration JSON](#image-json) that gets hashed references hashes of each layer in the image, this formulation of the ImageID makes images content-addressable.

(first appeared in e3d8984 , from moby/moby#22264)

The spec demands "ImageID" to be computed by hashing the config, however, containerd has been hashing the index as the image ID.
Docker has begun to use containerd's image ID too:

So I suggest amending the spec to match the reality.
We can also consider saying that "image ID is opaque to implementations".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions