Docker Community Forums

I need to retrieve all image labels for images in our hosted registry and found that they are contained in the image Manifest.

Unfortunately there seems to be no clean and elegant way to retrieve the labels directly (e.g. as a Map), instead they are stuffed into the legacy history collection, in the middle of a v1Compatibility attribute.

Is there a better way than to regex through it, as I find this quite a common use case and labels are a standard feature of docker…

I don’t understand why labels are treated as legacy and hidden in a compatibility section, instead of being included on the top level of Manifests, as the spec is quite new and labels have not been deprecated…?

TL;DR;
Add the ability to pull down an image JSON from a registry w/o the need to download all layers.
This is trying...

In short, we need to fetch the blob of the “configuration layer”, which contains the container config entry as JSON with all the image-level metadata including labels.
Changing .container_config.Entrypoint to .container_config.Labels returns the image labels from the registry without downloading the whole image.