Merge pull request #1354 from dvdksn/fix-cache-cmds

docs: fix cache command examples
This commit is contained in:
CrazyMax 2022-10-17 22:32:29 +02:00 committed by GitHub
commit 718b8085fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 36 additions and 33 deletions

View File

@ -22,9 +22,9 @@ The `azblob` cache store uploads your resulting build cache to
## Synopsis
```console
$ docker buildx build . --push -t <registry>/<image> \
$ docker buildx build --push -t <registry>/<image> \
--cache-to type=azblob,name=<cache-image>[,parameters...] \
--cache-from type=azblob,name=<cache-image>[,parameters...]
--cache-from type=azblob,name=<cache-image>[,parameters...] .
```
The following table describes the available CSV parameters that you can pass to

View File

@ -26,9 +26,9 @@ inside your GitHub action pipelines, as long as your use case falls within the
## Synopsis
```console
$ docker buildx build . --push -t <registry>/<image> \
$ docker buildx build --push -t <registry>/<image> \
--cache-to type=gha[,parameters...] \
--cache-from type=gha[,parameters...]
--cache-from type=gha[,parameters...] .
```
The following table describes the available CSV parameters that you can pass to
@ -67,12 +67,12 @@ example, the cache is set to a combination of the branch name and the image
name, to ensure each branch gets its own cache):
```console
$ docker buildx build . --push -t <registry>/<image> \
--cache-to type=gha,url=...,token=...,scope=$GITHUB_REF_NAME-image
--cache-from type=gha,url=...,token=...,scope=$GITHUB_REF_NAME-image
$ docker buildx build . --push -t <registry>/<image2> \
--cache-to type=gha,url=...,token=...,scope=$GITHUB_REF_NAME-image2
--cache-from type=gha,url=...,token=...,scope=$GITHUB_REF_NAME-image2
$ docker buildx build --push -t <registry>/<image> \
--cache-to type=gha,url=...,token=...,scope=$GITHUB_REF_NAME-image \
--cache-from type=gha,url=...,token=...,scope=$GITHUB_REF_NAME-image .
$ docker buildx build --push -t <registry>/<image2> \
--cache-to type=gha,url=...,token=...,scope=$GITHUB_REF_NAME-image2 \
--cache-from type=gha,url=...,token=...,scope=$GITHUB_REF_NAME-image2 .
```
GitHub's

View File

@ -56,9 +56,9 @@ Example `buildx` command using the `registry` backend, using import and export
cache:
```console
$ docker buildx build . --push -t <registry>/<image> \
$ docker buildx build --push -t <registry>/<image> \
--cache-to type=registry,ref=<registry>/<cache-image>[,parameters...] \
--cache-from type=registry,ref=<registry>/<cache-image>[,parameters...]
--cache-from type=registry,ref=<registry>/<cache-image>[,parameters...] .
```
> **Warning**
@ -78,10 +78,10 @@ following example shows importing cache from multiple locations using the
registry cache backend:
```console
$ docker buildx build . --push -t <registry>/<image> \
$ docker buildx build --push -t <registry>/<image> \
--cache-to type=registry,ref=<registry>/<cache-image>:<branch> \
--cache-from type=registry,ref=<registry>/<cache-image>:<branch> \
--cache-from type=registry,ref=<registry>/<cache-image>:main
--cache-from type=registry,ref=<registry>/<cache-image>:main .
```
## Configuration options
@ -109,9 +109,9 @@ Mode can be set to either of two options: `mode=min` or `mode=max`. For example,
to build the cache with `mode=max` with the registry backend:
```console
$ docker buildx build . --push -t <registry>/<image> \
$ docker buildx build --push -t <registry>/<image> \
--cache-to type=registry,ref=<registry>/<cache-image>,mode=max \
--cache-from type=registry,ref=<registry>/<cache-image>
--cache-from type=registry,ref=<registry>/<cache-image> .
```
This option is only set when exporting a cache, using `--cache-to`. When
@ -140,9 +140,9 @@ To select the compression algorithm, you can use the
cache with `compression=zstd`:
```console
$ docker buildx build . --push -t <registry>/<image> \
$ docker buildx build --push -t <registry>/<image> \
--cache-to type=registry,ref=<registry>/<cache-image>,compression=zstd \
--cache-from type=registry,ref=<registry>/<cache-image>
--cache-from type=registry,ref=<registry>/<cache-image> .
```
Use the `compression-level=<value>` option alongside the `compression` parameter
@ -172,9 +172,9 @@ images with Docker media types or with OCI media types. To export OCI media type
cache, use the `oci-mediatypes` property:
```console
$ docker buildx build . --push -t <registry>/<image> \
$ docker buildx build --push -t <registry>/<image> \
--cache-to type=registry,ref=<registry>/<cache-image>,oci-mediatypes=true \
--cache-from type=registry,ref=<registry>/<cache-image>
--cache-from type=registry,ref=<registry>/<cache-image> .
```
This property is only meaningful with the `--cache-to` flag. When fetching

View File

@ -11,23 +11,25 @@ want to consider the [registry](./registry.md) cache.
## Synopsis
```console
$ docker buildx build . --push -t <registry>/<image> \
$ docker buildx build --push -t <registry>/<image> \
--cache-to type=inline \
--cache-from type=registry,ref=<registry>/image
--cache-from type=registry,ref=<registry>/image .
```
To export cache using `inline` storage, pass `type=inline` to the `--cache-to`
option:
```console
$ docker buildx build . --push -t <registry>/<image> --cache-to type=inline
$ docker buildx build --push -t <registry>/<image> \
--cache-to type=inline .
```
Alternatively, you can also export inline cache by setting the build argument
`BUILDKIT_INLINE_CACHE=1`, instead of using the `--cache-to` flag:
```console
$ docker buildx build . --push -t <registry>/<image> --arg BUILDKIT_INLINE_CACHE=1
$ docker buildx build --push -t <registry>/<image> \
--arg BUILDKIT_INLINE_CACHE=1 .
```
To import the resulting cache on a future build, pass `type=registry` to
@ -35,7 +37,8 @@ To import the resulting cache on a future build, pass `type=registry` to
the specified registry:
```console
$ docker buildx build . --push -t <registry>/<image> --cache-from type=registry,ref=<registry>/<image>
$ docker buildx build --push -t <registry>/<image> \
--cache-from type=registry,ref=<registry>/<image> .
```
## Further reading

View File

@ -21,9 +21,9 @@ solution.
## Synopsis
```console
$ docker buildx build . --push -t <registry>/<image> \
$ docker buildx build --push -t <registry>/<image> \
--cache-to type=local,dest=path/to/local/dir[,parameters...] \
--cache-from type=local,src=path/to/local/dir,
--cache-from type=local,src=path/to/local/dir .
```
The following table describes the available CSV parameters that you can pass to
@ -88,9 +88,9 @@ When importing cache using `--cache-to`, you can specify the `digest` parameter
to force loading an older version of the cache, for example:
```console
$ docker buildx build . --push -t <registry>/<image> \
$ docker buildx build --push -t <registry>/<image> \
--cache-to type=local,dest=path/to/local/dir \
--cache-from type=local,ref=path/to/local/dir,digest=sha256:6982c70595cb91769f61cd1e064cf5f41d5357387bab6b18c0164c5f98c1f707
--cache-from type=local,ref=path/to/local/dir,digest=sha256:6982c70595cb91769f61cd1e064cf5f41d5357387bab6b18c0164c5f98c1f707 .
```
## Further reading

View File

@ -29,9 +29,9 @@ Unlike the simpler `inline` cache, the `registry` cache supports several
configuration parameters:
```console
$ docker buildx build . --push -t <registry>/<image> \
$ docker buildx build --push -t <registry>/<image> \
--cache-to type=registry,ref=<registry>/<cache-image>[,parameters...] \
--cache-from type=registry,ref=<registry>/<cache-image>
--cache-from type=registry,ref=<registry>/<cache-image> .
```
The following table describes the available CSV parameters that you can pass to

View File

@ -23,9 +23,9 @@ bucket.
## Synopsis
```console
$ docker buildx build . --push -t <user>/<image> \
$ docker buildx build --push -t <user>/<image> \
--cache-to type=s3,region=<region>,bucket=<bucket>,name=<cache-image>[,parameters...] \
--cache-from type=s3,region=<region>,bucket=<bucket>,name=<cache-image>
--cache-from type=s3,region=<region>,bucket=<bucket>,name=<cache-image> .
```
The following table describes the available CSV parameters that you can pass to