# DockerVolumeConfiguration

The configuration for a Docker volume.

Docker volumes are only supported when you are using the EC2 launch type.

- Source: [`aws-ecs/lib/base/task-definition.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-ecs/lib/base/task-definition.ts#L1251)

## Example

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_ecs as ecs } from 'aws-cdk-lib';
const dockerVolumeConfiguration: ecs.DockerVolumeConfiguration = {
  driver: 'driver',
  scope: ecs.Scope.TASK,

  // the properties below are optional
  autoprovision: false,
  driverOpts: {
    driverOptsKey: 'driverOpts',
  },
  labels: {
    labelsKey: 'labels',
  },
};
```

## Properties

- `autoprovision`: boolean = false — Specifies whether the Docker volume should be created if it does not already exist.

  If true is specified, the Docker volume will be created for you.

- `driver`: string (required) — The Docker volume driver to use.

- `driverOpts`: { [key: string]: string } — A map of Docker driver-specific options passed through.

  **Default:** No options

- `labels`: { [key: string]: string } — Custom metadata to add to your Docker volume.

  **Default:** No labels

- `scope`: [Scope](/cdk/api/v2/docs/aws-cdk-lib.aws_ecs.Scope.html) (required) — The scope for the Docker volume that determines its lifecycle.
