build: add s3 cache backend configuration params

Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
This commit is contained in:
David Karlsson 2023-09-05 13:59:26 +02:00
parent 043cc6817d
commit ca2f3732a0
1 changed files with 24 additions and 17 deletions

View File

@ -31,32 +31,39 @@ $ docker buildx build --push -t <user>/<image> \
The following table describes the available CSV parameters that you can pass to
`--cache-to` and `--cache-from`.
| Name | Option | Type | Default | Description |
| ------------------- | ----------------------- | ----------- | ------- | --------------------------------------------- |
| `region` | `cache-to`,`cache-from` | String | | Geographic location. |
| `bucket` | `cache-to`,`cache-from` | String | | Name of the S3 bucket used for caching |
| `name` | `cache-to`,`cache-from` | String | | Name of the cache image |
| `access_key_id` | `cache-to`,`cache-from` | String | | See [authentication][1] |
| `secret_access_key` | `cache-to`,`cache-from` | String | | See [authentication][1] |
| `session_token` | `cache-to`,`cache-from` | String | | See [authentication][1] |
| `mode` | `cache-to` | `min`,`max` | `min` | Cache layers to export, see [cache mode][2]. |
| `ignore-error` | `cache-to` | Boolean | `false` | Ignore errors caused by failed cache exports. |
| Name | Option | Type | Default | Description |
| ------------------- | ----------------------- | ----------- | ------- | ---------------------------------------------------------- |
| `region` | `cache-to`,`cache-from` | String | | Requried. Geographic location. |
| `bucket` | `cache-to`,`cache-from` | String | | Required. Name of the S3 bucket. |
| `name` | `cache-to`,`cache-from` | String | | Name of the cache image. |
| `endpoint_url` | `cache-to`,`cache-from` | String | | Endpoint of the S3 bucket. |
| `blobs_prefix` | `cache-to`,`cache-from` | String | | Prefix to prepend to blob filenames. |
| `manifests_prefix` | `cache-to`,`cache-from` | String | | Prefix to prepend on manifest filenames. |
| `use_path_style` | `cache-to`,`cache-from` | Boolean | `false` | When `true`, uses `bucket` in the URL instead of hostname. |
| `access_key_id` | `cache-to`,`cache-from` | String | | See [authentication][1]. |
| `secret_access_key` | `cache-to`,`cache-from` | String | | See [authentication][1]. |
| `session_token` | `cache-to`,`cache-from` | String | | See [authentication][1]. |
| `mode` | `cache-to` | `min`,`max` | `min` | Cache layers to export, see [cache mode][2]. |
| `ignore-error` | `cache-to` | Boolean | `false` | Ignore errors caused by failed cache exports. |
[1]: #authentication
[2]: index.md#cache-mode
[2]: _index.md#cache-mode
## Authentication
`access_key_id`, `secret_access_key`, and `session_token`, if left unspecified,
are read from environment variables on the BuildKit server following the scheme
for the [AWS Go SDK](https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/configuring-sdk.html).
The environment variables are read from the server, not the Buildx client.
Buildx can reuse existing AWS credentials, configured either using a
credentials file or environment variables, for pushing and pulling cache to S3.
Alternatively, you can use the `access_key_id`, `secret_access_key`, and
`session_token` attributes to specify credentials directly on the CLI.
<!-- FIXME: update once https://github.com/docker/buildx/pull/1294 is released -->
Refer to [AWS Go SDK, Specifying Credentials][3] for details about
authentication using environment variables and credentials file.
[3]: https://docs.aws.amazon.com/sdk-for-go/v1/developer-guide/configuring-sdk.html#specifying-credentials
## Further reading
For an introduction to caching see [Optimizing builds with cache](../index.md).
For an introduction to caching see [Optimizing builds with cache](../_index.md).
For more information on the `s3` cache backend, see the
[BuildKit README](https://github.com/moby/buildkit#s3-cache-experimental).