buildx icon indicating copy to clipboard operation
buildx copied to clipboard

Ability to retrieve image IDs when using multiple exporters

Open cowwoc opened this issue 5 months ago • 2 comments

Description

If I invoke docker buildx build --output type=docker --output type=oci,dest=oci.tar contextPath I should be able to add --iidfile or --metadata-file and have the generated files contain the image IDs of both images.

If you try this today, the generated files will contain one of the IDs but not the other.

I am expecting the generated files to contain both IDs and an indication of which exporter each one corresponds to.

Today, if I invoke the above command on this Dockerfile:

FROM scratch

COPY empty.txt .

I get this output:

[internal] load build definition from Dockerfile
	transferring 76/0 0.007
[internal] load .dockerignore
[internal] load build context
	transferring 2512/0 0.004
[1/1] COPY logback-test.xml .
exporting to oci image format
	exporting layers 0/0 0.058
	exporting manifest sha256:56b029f44ccd04d2f15a2b9ad39957f469c29fc880053750c2913ee09aab64bd 0/0 0.735
	exporting config sha256:fcbc65ed4feab765a528cdaa54b355b433dc6e4d86f29cc6dfc0a4ca20315110 0/0 0.004
	sending tarball 0/0 0.006
exporting to image
	exporting attestation manifest sha256:28f376eaa0ec7b68391b720540d177f6a1caacb59b020bdc8bec92c91845688f 0/0 0.018
	exporting manifest list sha256:3f4a3acab60068864e10ec341ef83a418edfd355185bd70d792be8c719eccc51 0/0 0.01
	naming to moby-dangling@sha256:3f4a3acab60068864e10ec341ef83a418edfd355185bd70d792be8c719eccc51 0/0 0.003
	unpacking to moby-dangling@sha256:3f4a3acab60068864e10ec341ef83a418edfd355185bd70d792be8c719eccc51 0/0 0.018

The OCI and Docker images have different IDs. I'd like to be able to look then up without parsing the console output.

cowwoc avatar Jul 09 '25 23:07 cowwoc

This issue might be related to https://github.com/moby/buildkit/pull/5586

cowwoc avatar Jul 09 '25 23:07 cowwoc

Yes it needs https://github.com/moby/buildkit/pull/5586 first

crazy-max avatar Aug 05 '25 12:08 crazy-max