Home Explore Blog CI



docker

3rd chunk of `content/manuals/build/exporters/_index.md`
a3d31235b9ae0a8cb0a4d6810ac8270405ddc3c064c91157000000010000093b
specified location. The `tar` exporter creates a tarball archive file.

```console
$ docker buildx build --output type=local,dest=<path/to/output> .
```

The `local` exporter is useful in [multi-stage builds](../building/multi-stage.md)
since it allows you to export only a minimal number of build artifacts, such as
self-contained binaries.

### Cache-only export

The `cacheonly` exporter can be used if you just want to run a build, without
exporting any output. This can be useful if, for example, you want to run a test
build. Or, if you want to run the build first, and create exports using
subsequent commands. The `cacheonly` exporter creates a build cache, so any
successive builds are instant.

```console
$ docker buildx build --output type=cacheonly
```

If you don't specify an exporter, and you don't provide short-hand options like
`--load` that automatically selects the appropriate exporter, Buildx defaults to
using the `cacheonly` exporter. Except if you build using the `docker` driver,
in which case you use the `docker` exporter.

Buildx logs a warning message when using `cacheonly` as a default:

```console
$ docker buildx build .
WARNING: No output specified with docker-container driver.
         Build result will only remain in the build cache.
         To push result image into registry use --push or
         to load image into docker use --load
```

## Multiple exporters

{{< summary-bar feature_name="Build multiple exporters" >}}

You can use multiple exporters for any given build by specifying the `--output`
flag multiple times. This requires **both Buildx and BuildKit** version 0.13.0
or later.

The following example runs a single build, using three
different exporters:

- The `registry` exporter to push the image to a registry
- The `local` exporter to extract the build results to the local filesystem
- The `--load` flag (a shorthand for the `image` exporter) to load the results to the local image store.

```console
$ docker buildx build \
  --output type=registry,tag=<registry>/<image> \
  --output type=local,dest=<path/to/output> \
  --load .
```

## Configuration options

This section describes some configuration options available for exporters.

The options described here are common for at least two or more exporter types.
Additionally, the different exporters types support specific parameters as well.

Title: Buildx Exporters: Local, Cache-only, Multiple, and Configuration Options
Summary
The `local` exporter unpacks the build filesystem into a directory structure, useful for multi-stage builds. The `cacheonly` exporter runs a build without exporting, creating a cache for faster subsequent builds. Multiple exporters can be used in a single build with Buildx and BuildKit version 0.13.0 or later, combining functionalities like pushing to a registry, extracting to a local filesystem, and loading to the local image store. The document then introduces configuration options common to multiple exporters, setting the stage for discussing exporter-specific parameters.