Home Explore Blog CI



docker

7th chunk of `content/manuals/build/building/variables.md`
9f40afc048160a5aa3cab27fd14d335102afc5d9f876649c00000001000009fe
for authenticating to a Git server when using a remote Bake definition in a private repository.
This is similar to SSH mounts for builds, but facilitates the pre-flight authentication in Bake when resolving the build definition.

Setting this environment is typically not necessary, because Bake will use the `SSH_AUTH_SOCK` agent socket by default.
You only need to specify this variable if you want to use a socket with a different filepath.
This variable can take multiple paths using a comma-separated string.

Usage:

```console
$ export BUILDX_BAKE_GIT_SSH=/run/foo/listener.sock,~/.creds/ssh.sock
```

### BUILDX_BUILDER

Overrides the configured builder instance. Same as the `docker buildx --builder`
CLI flag.

Usage:

```console
$ export BUILDX_BUILDER=my-builder
```

### BUILDX_CONFIG

You can use `BUILDX_CONFIG` to specify the directory to use for build
configuration, state, and logs. The lookup order for this directory is as
follows:

- `$BUILDX_CONFIG`
- `$DOCKER_CONFIG/buildx`
- `~/.docker/buildx` (default)

Usage:

```console
$ export BUILDX_CONFIG=/usr/local/etc
```

### BUILDX_CPU_PROFILE

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

If specified, Buildx generates a `pprof` CPU 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_CPU_PROFILE=buildx_cpu.prof
```

### BUILDX_EXPERIMENTAL

Enables experimental build features.

Usage:

```console
$ 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

Title: Buildx Configuration Variables: SSH, Builder, Configuration, Profiling, Experimental Features, and Git Information
Summary
The text details several Buildx configuration variables. `BUILDX_BAKE_GIT_SSH` specifies SSH agent socket filepaths for Git authentication in Bake. `BUILDX_BUILDER` overrides the configured builder instance. `BUILDX_CONFIG` sets the directory for build configuration. `BUILDX_CPU_PROFILE` generates a CPU profile. `BUILDX_EXPERIMENTAL` enables experimental features. `BUILDX_GIT_CHECK_DIRTY` checks for dirty state in source control for provenance attestations, and `BUILDX_GIT_INFO` removes source control information from provenance attestations. `BUILDX_GIT_LABELS` adds provenance labels based on Git information to built images.