Home Explore Blog CI



docker

8th chunk of `content/manuals/build/building/variables.md`
e5b1014c73b3c9c87943faf809cf7105f57638fca7009d1c0000000100000d67
$ export BUILDX_EXPERIMENTAL=1
```

### BUILDX_GIT_CHECK_DIRTY

{{< summary-bar feature_name="Buildx Git check dirty" >}}

When set to true, checks for dirty state in source control information for
[provenance attestations](/manuals/build/metadata/attestations/slsa-provenance.md).

Usage:

```console
$ export BUILDX_GIT_CHECK_DIRTY=1
```

### BUILDX_GIT_INFO

{{< summary-bar feature_name="Buildx Git info" >}}

When set to false, removes source control information from
[provenance attestations](/manuals/build/metadata/attestations/slsa-provenance.md).

Usage:

```console
$ export BUILDX_GIT_INFO=0
```

### BUILDX_GIT_LABELS

{{< summary-bar feature_name="Buildx Git labels" >}}

Adds provenance labels, based on Git information, to images that you build. The
labels are:

- `com.docker.image.source.entrypoint`: Location of the Dockerfile relative to
  the project root
- `org.opencontainers.image.revision`: Git commit revision
- `org.opencontainers.image.source`: SSH or HTTPS address of the repository

Example:

```json
  "Labels": {
    "com.docker.image.source.entrypoint": "Dockerfile",
    "org.opencontainers.image.revision": "5734329c6af43c2ae295010778cd308866b95d9b",
    "org.opencontainers.image.source": "git@github.com:foo/bar.git"
  }
```

Usage:

- Set `BUILDX_GIT_LABELS=1` to include the `entrypoint` and `revision` labels.
- Set `BUILDX_GIT_LABELS=full` to include all labels.

If the repository is in a dirty state, the `revision` gets a `-dirty` suffix.

### BUILDX_MEM_PROFILE

{{< summary-bar feature_name="Buildx mem profile" >}}

If specified, Buildx generates a `pprof` memory profile at the specified
location.

> [!NOTE]
> This property is only useful for when developing Buildx. The profiling data
> is not relevant for analyzing a build's performance.

Usage:

```console
$ export BUILDX_MEM_PROFILE=buildx_mem.prof
```

### BUILDX_METADATA_PROVENANCE

{{< summary-bar feature_name="Buildx metadata provenance" >}}

By default, Buildx includes minimal provenance information in the metadata file
through [`--metadata-file` flag](/reference/cli/docker/buildx/build/#metadata-file).
This environment variable allows you to customize the provenance information
included in the metadata file:
* `min` sets minimal provenance (default).
* `max` sets full provenance.
* `disabled`, `false` or `0` does not set any provenance.

### BUILDX_METADATA_WARNINGS

{{< summary-bar feature_name="Buildx metadata warnings" >}}

By default, Buildx does not include build warnings in the metadata file through
[`--metadata-file` flag](/reference/cli/docker/buildx/build/#metadata-file).
You can set this environment variable to `1` or `true` to include them.

### BUILDX_NO_DEFAULT_ATTESTATIONS

{{< summary-bar feature_name="Buildx no default" >}}

By default, BuildKit v0.11 and later adds
[provenance attestations](/manuals/build/metadata/attestations/slsa-provenance.md) to images you
build. Set `BUILDX_NO_DEFAULT_ATTESTATIONS=1` to disable the default provenance
attestations.

Usage:

```console
$ export BUILDX_NO_DEFAULT_ATTESTATIONS=1
```

### BUILDX_NO_DEFAULT_LOAD

When you build an image using the `docker` driver, the image is automatically
loaded to the image store when the build finishes. Set `BUILDX_NO_DEFAULT_LOAD`
to disable automatic loading of images to the local container store.

Usage:

```console
$ export BUILDX_NO_DEFAULT_LOAD=1
```

<!-- vale Docker.HeadingSentenceCase = YES -->

Title: Buildx Configuration Variables: Git Information, Profiling, Metadata Provenance, Warnings, and Default Attestations/Loading
Summary
This section details Buildx configuration variables related to Git information in images (`BUILDX_GIT_LABELS`), memory profiling (`BUILDX_MEM_PROFILE`), metadata provenance and warnings (`BUILDX_METADATA_PROVENANCE`, `BUILDX_METADATA_WARNINGS`), and disabling default attestations and image loading (`BUILDX_NO_DEFAULT_ATTESTATIONS`, `BUILDX_NO_DEFAULT_LOAD`). It explains how to use these variables to customize the build process, including adding Git-based labels to images, generating memory profiles for Buildx development, controlling the level of provenance information in metadata files, including build warnings in metadata files, disabling default provenance attestations, and preventing automatic loading of images to the local container store.