Open dvdksn opened 8 months ago
docker buildx imagetools create --annotation "index:country=estonia" --dry-run davidkarlsson416/build:annotations
docker buildx imagetools create --annotation "manifest-descriptor:country=estonia" --dry-run davidkarlsson416/build:annotations
docker buildx imagetools create --annotation "manifest-descriptor[linux/amd64]:country=estonia" --dry-run davidkarlsson416/build:annotations
But yeah, these error messages are really confusing.
@tonistiigi your examples work, the ones I tried (no prefix, and the manifest:
prefix) should also work if imagetools create
worked the same way as with build
or bake
-- it would create an annotation on the manifest(s). But currently it just seems to fail.
Support for manifest
is more complex than the other cases, since it requires modifying the manifest, see here from the original PR: https://github.com/docker/buildx/pull/1965#discussion_r1281623654.
I remember discussing this internally at some point, and I think we had mixed feelings on whether imagetools create
should modify manifest digests... though I suppose that the user is explicitly requesting this behavior, so maybe it should be fine.
Yes, imagetools create
does not make modifications to the manifest. It either copies indexes/manifests with guaranteed immutability or creates new indexes from existing descriptors. I don't think we should change that. Changing manifest is a different kind of tool that would change for example, env or layers as well and change the digest. Note that any modification of the manifest also invalidates any attestation.
Got it, thanks. In addition to improving the error message, would it make sense to specify a default level for imagetools create
, such that if no prefix type is specified, the annotation is created on e.g. index
?
Contributing guidelines
I've found a bug and checked that ...
Description
When I try to create a new image with annotation, using
buildx imagetools create --annotation
, I get the following errorExpected behaviour
I expected to be able to create an image with the
country=sweden
annotationActual behaviour
error
Buildx version
github.com/docker/buildx v0.12.0 542e5d810e4a1a155684f5f3c5bd7e797632a12f
Docker info
No response
Builders list
Configuration
n/a
Build logs
No response
Additional info
No response