# docker buildx build Command Reference

> Reference for docker buildx build in CI: --push, --cache-from, --cache-to type=gha, and multi-arch --platform for BuildKit-powered image builds in pipelines.

Source: https://latchkey.dev/learn/command-reference/docker-buildx-build-command-reference  
Updated: 2026-06-26

Build images with the full BuildKit feature set, including remote cache and multi-arch.

docker buildx build is the BuildKit-backed build command. It adds capabilities the classic builder lacks: pushing directly from the build, importing and exporting layer cache from external backends, and building for multiple platforms in one invocation.

## Common flags

- `--push` - build and push to the registry in one step (implies --output type=registry)
- `--load` - load the result into the local image store (single platform only)
- `--platform` - comma-separated target platforms, e.g. linux/amd64,linux/arm64
- `--cache-from` - import cache, e.g. type=gha or type=registry,ref=...
- `--cache-to` - export cache, e.g. type=gha,mode=max
- `--tag`, `--build-arg`, `--target`, `--file` - same meaning as docker build
- `--provenance` - attach (or disable with =false) SLSA provenance attestations

## Example

```shell
docker buildx build \
  --platform linux/amd64,linux/arm64 \
  --cache-from type=gha \
  --cache-to type=gha,mode=max \
  -t myorg/app:${{ github.sha }} \
  --push \
  .
```

## In CI

Use --cache-to type=gha,mode=max with --cache-from type=gha to persist BuildKit layer cache in the GitHub Actions cache across runs; mode=max caches intermediate stages too. For multi-arch images you must --push (you cannot --load more than one platform). On Latchkey managed runners the GitHub Actions cache backend works the same as on hosted runners.

## FAQ

### docker buildx build Command Reference?

docker buildx build is the BuildKit-backed build command. It adds capabilities the classic builder lacks: pushing directly from the build, importing and exporting layer cache from external backends, and building for multiple platforms in one invocation.

### In CI?

Use --cache-to type=gha,mode=max with --cache-from type=gha to persist BuildKit layer cache in the GitHub Actions cache across runs; mode=max caches intermediate stages too. For multi-arch images you must --push (you cannot --load more than one platform).

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
