Image and registry exporters

The image exporter outputs the build result into a container image format. The registry exporter is identical, but it automatically pushes the result by setting push=true.

Synopsis

Build a container image using the image and registry exporters:

$ docker buildx build --output type=image[,parameters] .
$ docker buildx build --output type=registry[,parameters] .

The following table describes the available parameters that you can pass to --output for type=image:

ParameterTypeDefaultDescription
nameStringSpecify image name(s)
pushtrue,falsefalsePush after creating the image.
push-by-digesttrue,falsefalsePush image without name.
registry.insecuretrue,falsefalseAllow pushing to insecure registry.
dangling-name-prefix<value>Name image with prefix@<digest>, used for anonymous images
name-canonicaltrue,falseAdd additional canonical name name@<digest>
compressionuncompressed,gzip,estargz,zstdgzipCompression type, see compression
compression-level0..22Compression level, see compression
force-compressiontrue,falsefalseForcefully apply compression, see compression
oci-mediatypestrue,falsefalseUse OCI media types in exporter manifests, see OCI Media types
unpacktrue,falsefalseUnpack image after creation (for use with containerd)
storetrue,falsetrueStore the result images to the worker's (for example, containerd) image store, and ensures that the image has all blobs in the content store. Ignored if the worker doesn't have image store (when using OCI workers, for example).
annotation.<key>StringAttach an annotation with the respective key and value to the built image,see annotations

Annotations

These exporters support adding OCI annotation using annotation parameter, followed by the annotation name using dot notation. The following example sets the org.opencontainers.image.title annotation:

$ docker buildx build \
    --output "type=<type>,name=<registry>/<image>,annotation.org.opencontainers.image.title=<title>" .

For more information about annotations, see BuildKit documentation.

Further reading

For more information on the image or registry exporters, see the BuildKit README.