Verify the added attestations
In this final step, we will verify that the attestations were successfully added to the images and inspect their contents. We can use the docker buildx imagetools inspect
command to view the manifest of an image, which includes information about any associated attestations.
The basic syntax for inspecting an image manifest is:
docker buildx imagetools inspect <image_tag>
Let's first inspect the alpine:attested
image, which we created using the --attestation-file
flag.
docker buildx imagetools inspect alpine:attested
You should see detailed output about the image manifest. Look for a section related to "attestations". You should find an entry with the predicate type https://example.com/attestation/v1
and the data from your attestation.json
file.
...
"attestations": [
{
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"payload": "...",
"predicateType": "https://example.com/attestation/v1"
}
],
...
Now, let's inspect the alpine:attested-v2
image, which we created using the --predicate-type
flag to override the predicate type.
docker buildx imagetools inspect alpine:attested-v2
Again, look for the "attestations" section. This time, you should see an entry with the predicate type https://example.com/another-attestation/v2
, even though the content of the attestation data is the same as before.
...
"attestations": [
{
"mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"payload": "...",
"predicateType": "https://example.com/another-attestation/v2"
}
],
...
This confirms that we successfully added attestations to the Docker images and that the --predicate-type
flag can be used to explicitly set the predicate type.
You have now learned how to prepare an image and an attestation file, add attestations to an image using both the --attestation-file
and --predicate-type
flags, and verify the added attestations using docker buildx imagetools inspect
.