mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-08-11 06:15:53 +08:00
Output correct image ID when using Docker with the containerd-snapshotter.
Prior to this change, the following command emits the wrong image ID when buildx uses the "docker-container" driver and Docker is configured with the containerd-snapshotter. $ docker buildx build --load --iidfile=img.txt $ docker run --rm "$(cat img.txt)" echo hello docker: Error response from daemon: No such image: sha256:4ac37e81e00f242010e42f3251094e47de6100e01d25e9bd0feac6b8906976df. See 'docker run --help'. The problem is that buildx is outputing the incorrect image ID in this scenario (it's outputing the container image config digest, instead of the container image digest used by the containerd-snapshotter). This commit fixes this. See https://github.com/moby/moby/issues/45458. Signed-off-by: Cesar Talledo <cesar.talledo@docker.com>
This commit is contained in:
@@ -525,7 +525,6 @@ func BuildWithResultHandler(ctx context.Context, nodes []builder.Node, opts map[
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
node := dp.Node().Driver
|
||||
if node.IsMobyDriver() {
|
||||
for _, e := range so.Exports {
|
||||
@@ -561,6 +560,14 @@ func BuildWithResultHandler(ctx context.Context, nodes []builder.Node, opts map[
|
||||
}
|
||||
}
|
||||
}
|
||||
// if prefer-image-digest is set in the solver options, remove the image
|
||||
// config digest from the exporter's response
|
||||
for _, e := range so.Exports {
|
||||
if e.Attrs["prefer-image-digest"] == "true" {
|
||||
delete(rr.ExporterResponse, exptypes.ExporterImageConfigDigestKey)
|
||||
break
|
||||
}
|
||||
}
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user