For adding some annotations/labels to a image, we first have to create the container from the image, and then we can add some annotations/labels using buildah-config: buildah-config [options] containerID
But this requires first creating a container from image, then adding the required annotation/label, and then committing the changes back to an image.
But creating a container just for making some small change to the image configuration seems a unnecessary step which would take additional time and memory.
Is there a better way to add annotations/labels to a image?
For an image on a registry (or in an OCI Layout structure on the filesystem) there are various tools to modify that image. From go-containerregistry (by Google), there's
crane mutate:And from regclient (by myself), there's
regctl image mod:For example: