Reputation: 1378
Past few days I have been struggling with the multi-arch manifest annotation. I use buildah/podman for creating my images, but I cannot discover a way how to add the common org.opencontainers.image.description annotation to the manifest defining multi-arch images.
In general, I build my images by using the following commands sequence:
# Build all arch. images
#
buildah bud --platform linux/amd64 -f Dockerfile --format oci --tls-verify=true -t debian-gcc:gcc_bullseye-linuxamd64 /home/runner/work/docker-images/docker-images
buildah bud --platform linux/arm64 -f Dockerfile --format oci --tls-verify=true -t debian-gcc:gcc_bullseye-linuxarm64 /home/runner/work/docker-images/docker-images
# Create a manifest and add all arch. images there.
#
buildah manifest create debian-gcc:gcc_bullseye
buildah manifest add debian-gcc:gcc_bullseye debian-gcc:gcc_bullseye-linuxamd64
buildah manifest add debian-gcc:gcc_bullseye debian-gcc:gcc_bullseye-linuxarm64
# Inspect the manifest
#
podman manifest inspect debian-gcc:gcc_bullseye
Manifest contains the following:
{
"schemaVersion": 2,
"mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
"manifests": [
{
"mediaType": "application/vnd.oci.image.manifest.v1+json",
"size": 500,
"digest": "sha256:7dbefc31c7b5f7c4f67f18f92213daec8c48740d9533996363812de4385b9528",
"platform": {
"architecture": "amd64",
"os": "linux"
}
},
{
"mediaType": "application/vnd.oci.image.manifest.v1+json",
"size": 500,
"digest": "sha256:968fc2d27179baa3e7f8c85c7657659c5c67807dcd002922edce1437d22645f9",
"platform": {
"architecture": "arm64",
"os": "linux"
}
}
]
}
I would like to add an annotation for this manifest, but I have always failed so far.
The expected result would be:
{
"schemaVersion": 2,
"mediaType": "application/vnd.docker.distribution.manifest.list.v2+json",
"manifests": [
{
"mediaType": "application/vnd.oci.image.manifest.v1+json",
"size": 500,
"digest": "sha256:7dbefc31c7b5f7c4f67f18f92213daec8c48740d9533996363812de4385b9528",
"platform": {
"architecture": "amd64",
"os": "linux"
}
},
{
"mediaType": "application/vnd.oci.image.manifest.v1+json",
"size": 500,
"digest": "sha256:968fc2d27179baa3e7f8c85c7657659c5c67807dcd002922edce1437d22645f9",
"platform": {
"architecture": "arm64",
"os": "linux"
}
}
],
"annotations": {
"org.opencontainers.image.description: "My description ..."
}
}
I was trying to use the buildah-manifest-annotate without a success.
buildah manifest annotate --annotation org.opencontainers.image.description="My description ..." debian-gcc:gcc_bullseye debian-gcc:gcc_bullseye
I would say the main reason why this is failing is the fact that the manifest "vnd.oci.image.manifest.v1+json" cannot contain annotation per specification, however, the index "vnd.oci.image.index.v1+json" can.
The motivation for this is to have a proper description for multi-arch images in the github packages or the quay repository.
So, in summary, the question is how can I annotate the multi-arch image by using the podman
or buildah
?
I appreciate any help putting me back on the right track.
Upvotes: 1
Views: 550
Reputation: 36
Found this question while I was searching for an answer to the same problem. I know this question is almost a year old at this point, but I was able to figure it out.
There is now a --annotation
option for buildah manifest create
and podman manifest create
, added in buildah v1.35.0 and podman v5.0.0. See https://docs.podman.io/en/v5.0.0/markdown/podman-manifest-create.1.html#annotation-value. You can add annotations to existing manifests with --amend
.
In the given example you would use:
buildah manifest create --annotation "org.opencontainers.image.description=My description ..." debian-gcc:gcc_bullseye
Upvotes: 1