# DockerCacheOption

Options for configuring the Docker cache backend.

- Source: [`aws-ecr-assets/lib/image-asset.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0/packages/aws-cdk-lib/aws-ecr-assets/lib/image-asset.ts#L175)
- Type last changed: v2.69.0 · 14 Mar 2023

## Example

```ts
import { DockerImageAsset, Platform } from 'aws-cdk-lib/aws-ecr-assets';

const asset = new DockerImageAsset(this, 'MyBuildImage', {
  directory: path.join(__dirname, 'my-image'),
  cacheFrom: [{ type: 'registry', params: { ref: 'ghcr.io/myorg/myimage:cache' }}],
  cacheTo: { type: 'registry', params: { ref: 'ghcr.io/myorg/myimage:cache', mode: 'max', compression: 'zstd' }}
})
```

## Properties

- `params`: { [key: string]: string } — Any parameters to pass into the docker cache backend configuration.

  **Default:** {} No options provided

  Refer to https://docs.docker.com/build/cache/backends/ for cache backend configuration.

  ```ts
  declare const branch: string;

  const params = {
    ref: `12345678.dkr.ecr.us-west-2.amazonaws.com/cache:${branch}`,
    mode: "max",
  };
  ```

- `type`: string (required) = unspecified — The type of cache to use.

  Refer to https://docs.docker.com/build/cache/backends/ for full list of backends.

  ```ts
  'registry'
  ```
