docs/build/exporters/oci-docker.md

3.7 KiB

title keywords redirect_from
OCI and Docker exporters build, buildx, buildkit, exporter, oci, docker
/build/building/exporters/local-tar/

The oci exporter outputs the build result into an OCI image layout{:target="blank" rel="noopener" class=""} tarball. The docker exporter behaves the same way, except it exports a Docker image layout instead.

The docker driver doesn't support these exporters. You must use docker-container or some other driver if you want to generate these outputs.

Synopsis

Build a container image using the oci and docker exporters:

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

The following table describes the available parameters:

Parameter Type Default Description
name String Specify image name(s)
dest String Path
tar true,false true Bundle the output into a tarball layout
compression uncompressed,gzip,estargz,zstd gzip Compression type, see compression
compression-level 0..22 Compression level, see compression
force-compression true,false false Forcefully apply compression, see compression
oci-mediatypes true,false Use OCI media types in exporter manifests. Defaults to true for type=oci, and false for type=docker. See OCI Media types
annotation.<key> String Attach an annotation with the respective key and value to the built image,see annotations

Annotations

These exporters support adding OCI annotation using annotation.* dot notation parameter. The following example sets the org.opencontainers.image.title annotation for a build:

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

For more information about annotations, see BuildKit documentation{:target="blank" rel="noopener" class=""}.

Further reading

For more information on the oci or docker exporters, see the BuildKit README{:target="blank" rel="noopener" class=""}.