Repository navigation
No error when adding index annotations using docker exporter and docker driver #2605
Description
Activity
- changed the title
[-]No error when adding index annotations using docker exporter[/-][+]No error when adding index annotations using docker exporter and docker driver[/+]on Jul 16, 2024 Was this with containerd storage backend?
Both had the same issue in my tests
- addedkind/bugSomething isn't workingSomething isn't workingand removed
on Jul 19, 2024 10 remaining items
I was looking at this issue on moby and seems annotations are not passed to moby exporter on
Exportininp.Metadata: https://github.com/moby/moby/blob/d2ad7c36dc268e0d9751b803cec3003234740636/builder/builder-next/exporter/mobyexporter/export.go#L107 after debugging.Annotations on build are set as exporter attributes in:
buildx/controller/build/build.go
Lines 142 to 146 in 0d708c0
for _, o := range outputs { for k, v := range annotations { o.Attrs[k.String()] = v } } But exporter is not set in this repro so annotations will not be set in this case.
However if exporter is specified, annotations are set in exporter attributes:
docker buildx b --builder desktop-linux --annotation "index:foo=bar" --output type=docker .So I think it needs both a fix on buildx and moby.
Moby exporter that creates images in non-containerd Docker imagestore can not support annotations because BuildKit has no control of the manifests there. Manifests are only created by
docker push. Same for all theoci-mediatypes,compressionetc. options and attestations.Opened moby/moby#50295 to fix this on moby side first.
Opened moby/moby#50295 to fix this on moby side first.
This would happen during export at the end of the build so it might be better to fail early: #3384
Reacted by David KarlssonMakes sense! Thanks!
Contributing guidelines
I've found a bug and checked that ...
Description
Building an image with the
dockerbuilder, while also trying to add annotations toindex, doesn't result in an error.Expected behaviour
When trying to build an image with annotations on
index, using adocker-containerbuilder, my build fails as expected if I try to use thedockerexporter.Actual behaviour
Buildx version
github.com/docker/buildx 3005743 3005743
Docker info
No response
Builders list
Configuration
$ docker buildx b --builder desktop-linux --output type=docker --annotation "index:foo=bar" -<<< "FROM alpine"Build logs
No response
Additional info
No response