Skip to content

Commit d902b19

Browse files
authored
Merge pull request #3305 from crazy-max/build-cache-docs
docs: update links and add missing type for build cache exporters
2 parents 84f188a + 42dcd3c commit d902b19

File tree

1 file changed

+47
-50
lines changed

1 file changed

+47
-50
lines changed

docs/reference/buildx_build.md

Lines changed: 47 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -307,25 +307,25 @@ Same as [`buildx --builder`](buildx.md#builder).
307307
--cache-from=[NAME|type=TYPE[,KEY=VALUE]]
308308
```
309309

310-
Use an external cache source for a build. Supported types are `registry`,
311-
`local`, `gha` and `s3`.
310+
Use an external cache source for a build. Supported types are:
312311

313-
- [`registry` source](https://github.com/moby/buildkit#registry-push-image-and-cache-separately)
312+
- [`registry`](https://docs.docker.com/build/cache/backends/registry/)
314313
can import cache from a cache manifest or (special) image configuration on the
315314
registry.
316-
- [`local` source](https://github.com/moby/buildkit#local-directory-1) can
315+
- [`local`](https://docs.docker.com/build/cache/backends/local/) can
317316
import cache from local files previously exported with `--cache-to`.
318-
- [`gha` source](https://github.com/moby/buildkit#github-actions-cache-experimental)
317+
- [`gha`](https://docs.docker.com/build/cache/backends/gha/)
319318
can import cache from a previously exported cache with `--cache-to` in your
320-
GitHub repository
321-
- [`s3` source](https://github.com/moby/buildkit#s3-cache-experimental)
319+
GitHub repository.
320+
- [`s3`](https://docs.docker.com/build/cache/backends/s3/)
322321
can import cache from a previously exported cache with `--cache-to` in your
323-
S3 bucket
322+
S3 bucket.
323+
- [`azblob`](https://docs.docker.com/build/cache/backends/azblob/)
324+
can import cache from a previously exported cache with `--cache-to` in your
325+
Azure bucket.
324326

325327
If no type is specified, `registry` exporter is used with a specified reference.
326328

327-
`docker` driver currently only supports importing build cache from the registry.
328-
329329
```console
330330
$ docker buildx build --cache-from=user/app:cache .
331331
$ docker buildx build --cache-from=user/app .
@@ -335,7 +335,43 @@ $ docker buildx build --cache-from=type=gha .
335335
$ docker buildx build --cache-from=type=s3,region=eu-west-1,bucket=mybucket .
336336
```
337337

338-
More info about cache exporters and available attributes: https://github.com/moby/buildkit#export-cache
338+
> [!NOTE]
339+
> More info about cache exporters and available attributes can be found in the
340+
> [Cache storage backends documentation](https://docs.docker.com/build/cache/backends/)
341+
342+
### <a name="cache-to"></a> Export build cache to an external cache destination (--cache-to)
343+
344+
```text
345+
--cache-to=[NAME|type=TYPE[,KEY=VALUE]]
346+
```
347+
348+
Export build cache to an external cache destination. Supported types are:
349+
350+
- [`registry`](https://docs.docker.com/build/cache/backends/registry/) exports
351+
build cache to a cache manifest in the registry.
352+
- [`local`](https://docs.docker.com/build/cache/backends/local/) exports
353+
cache to a local directory on the client.
354+
- [`inline`](https://docs.docker.com/build/cache/backends/inline/) writes the
355+
cache metadata into the image configuration.
356+
- [`gha`](https://docs.docker.com/build/cache/backends/gha/) exports cache
357+
through the GitHub Actions Cache service API.
358+
- [`s3`](https://docs.docker.com/build/cache/backends/s3/) exports cache to a
359+
S3 bucket.
360+
- [`azblob`](https://docs.docker.com/build/cache/backends/azblob/) exports
361+
cache to an Azure bucket.
362+
363+
```console
364+
$ docker buildx build --cache-to=user/app:cache .
365+
$ docker buildx build --cache-to=type=inline .
366+
$ docker buildx build --cache-to=type=registry,ref=user/app .
367+
$ docker buildx build --cache-to=type=local,dest=path/to/cache .
368+
$ docker buildx build --cache-to=type=gha .
369+
$ docker buildx build --cache-to=type=s3,region=eu-west-1,bucket=mybucket .
370+
```
371+
372+
> [!NOTE]
373+
> More info about cache exporters and available attributes can be found in the
374+
> [Cache storage backends documentation](https://docs.docker.com/build/cache/backends/)
339375
340376
### <a name="call"></a> Invoke a frontend method (--call)
341377

@@ -498,45 +534,6 @@ test-go-redirects checks that the /go/ redirects are valid
498534
release (default) is an empty scratch image with only compiled assets
499535
```
500536

501-
### <a name="cache-to"></a> Export build cache to an external cache destination (--cache-to)
502-
503-
```text
504-
--cache-to=[NAME|type=TYPE[,KEY=VALUE]]
505-
```
506-
507-
Export build cache to an external cache destination. Supported types are
508-
`registry`, `local`, `inline`, `gha` and `s3`.
509-
510-
- [`registry` type](https://github.com/moby/buildkit#registry-push-image-and-cache-separately) exports build cache to a cache manifest in the registry.
511-
- [`local` type](https://github.com/moby/buildkit#local-directory-1) exports
512-
cache to a local directory on the client.
513-
- [`inline` type](https://github.com/moby/buildkit#inline-push-image-and-cache-together)
514-
writes the cache metadata into the image configuration.
515-
- [`gha` type](https://github.com/moby/buildkit#github-actions-cache-experimental)
516-
exports cache through the [GitHub Actions Cache service API](https://github.com/tonistiigi/go-actions-cache/blob/master/api.md#authentication).
517-
- [`s3` type](https://github.com/moby/buildkit#s3-cache-experimental) exports
518-
cache to a S3 bucket.
519-
520-
The `docker` driver only supports cache exports using the `inline` and `local`
521-
cache backends.
522-
523-
Attribute key:
524-
525-
- `mode` - Specifies how many layers are exported with the cache. `min` on only
526-
exports layers already in the final build stage, `max` exports layers for
527-
all stages. Metadata is always exported for the whole build.
528-
529-
```console
530-
$ docker buildx build --cache-to=user/app:cache .
531-
$ docker buildx build --cache-to=type=inline .
532-
$ docker buildx build --cache-to=type=registry,ref=user/app .
533-
$ docker buildx build --cache-to=type=local,dest=path/to/cache .
534-
$ docker buildx build --cache-to=type=gha .
535-
$ docker buildx build --cache-to=type=s3,region=eu-west-1,bucket=mybucket .
536-
```
537-
538-
More info about cache exporters and available attributes: https://github.com/moby/buildkit#export-cache
539-
540537
### <a name="cgroup-parent"></a> Use a custom parent cgroup (--cgroup-parent)
541538

542539
When you run `docker buildx build` with the `--cgroup-parent` option,

0 commit comments

Comments
 (0)