Skip to content
v2.277.0

DockerVolumeConfiguration Struct ​

The configuration for a Docker volume.

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

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',
  },
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_ecs as ecs

docker_volume_configuration = ecs.DockerVolumeConfiguration(
    driver="driver",
    scope=ecs.Scope.TASK,

    # the properties below are optional
    autoprovision=False,
    driver_opts={
        "driver_opts_key": "driverOpts"
    },
    labels={
        "labels_key": "labels"
    }
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.ecs.*;

DockerVolumeConfiguration dockerVolumeConfiguration = DockerVolumeConfiguration.builder()
        .driver("driver")
        .scope(Scope.TASK)

        // the properties below are optional
        .autoprovision(false)
        .driverOpts(Map.of(
                "driverOptsKey", "driverOpts"))
        .labels(Map.of(
                "labelsKey", "labels"))
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.ECS;

var dockerVolumeConfiguration = new DockerVolumeConfiguration {
    Driver = "driver",
    Scope = Scope.TASK,

    // the properties below are optional
    Autoprovision = false,
    DriverOpts = new Dictionary<string, string> {
        { "driverOptsKey", "driverOpts" }
    },
    Labels = new Dictionary<string, string> {
        { "labelsKey", "labels" }
    }
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

dockerVolumeConfiguration := &DockerVolumeConfiguration{
	Driver: jsii.String("driver"),
	Scope: awscdk.Aws_ecs.Scope_TASK,

	// the properties below are optional
	Autoprovision: jsii.Boolean(false),
	DriverOpts: map[string]*string{
		"driverOptsKey": jsii.String("driverOpts"),
	},
	Labels: map[string]*string{
		"labelsKey": jsii.String("labels"),
	},
}

Properties ​

autoprovisionoptionalbooleanautoprovisionoptionalboolautoprovisionoptionalBooleanAutoprovisionoptionalboolAutoprovisionoptional*bool= 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.

driverstringdriverstrdriverStringDriverstringDriver*stringrequired#
The Docker volume driver to use.
driverOptsoptional{ [key: string]: string }driver_optsoptionaltyping.Mapping[str, str]driverOptsoptionalMap<String, String>DriverOptsoptionalIDictionary<string, string>DriverOptsoptional*map[string]*string#
A map of Docker driver-specific options passed through.

Default: No options

labelsoptional{ [key: string]: string }labelsoptionaltyping.Mapping[str, str]labelsoptionalMap<String, String>LabelsoptionalIDictionary<string, string>Labelsoptional*map[string]*string#
Custom metadata to add to your Docker volume.

Default: No labels

scopeScopescopeScopescopeScopeScopeScopeScopeScoperequired#
The scope for the Docker volume that determines its lifecycle.