Skip to content
v2.275.0

DockerRunOptions Struct ​

Docker run options.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
const dockerRunOptions: cdk.DockerRunOptions = {
  command: ['command'],
  entrypoint: ['entrypoint'],
  environment: {
    environmentKey: 'environment',
  },
  network: 'network',
  platform: 'platform',
  securityOpt: 'securityOpt',
  user: 'user',
  volumes: [{
    containerPath: 'containerPath',
    hostPath: 'hostPath',

    // the properties below are optional
    consistency: cdk.DockerVolumeConsistency.CONSISTENT,
  }],
  volumesFrom: ['volumesFrom'],
  workingDirectory: 'workingDirectory',
};

Properties ​

commandoptionalstring[]commandoptionaltyping.List[str]commandoptionalList<String>Commandoptionalstring[]Commandoptional*[]*string#
The command to run in the container.

Default: run the command defined in the image

entrypointoptionalstring[]entrypointoptionaltyping.List[str]entrypointoptionalList<String>Entrypointoptionalstring[]Entrypointoptional*[]*string#
The entrypoint to run in the container.

Default: run the entrypoint defined in the image

environmentoptional{ [key: string]: string }environmentoptionaltyping.Mapping[str, str]environmentoptionalMap<String, String>EnvironmentoptionalIDictionary<string, string>Environmentoptional*map[string]*string#
The environment variables to pass to the container.

Default: no environment variables.

networkoptionalstringnetworkoptionalstrnetworkoptionalStringNetworkoptionalstringNetworkoptional*string#
Docker [Networking options](https://docs.docker.com/engine/reference/commandline/run/#connect-a-container-to-a-network---network).

Default: no networking options

platformoptionalstringplatformoptionalstrplatformoptionalStringPlatformoptionalstringPlatformoptional*string#
Set platform if server is multi-platform capable. _Requires Docker Engine API v1.38+_.

Default: no platform specified

Example value: linux/amd64

securityOptoptionalstringsecurity_optoptionalstrsecurityOptoptionalStringSecurityOptoptionalstringSecurityOptoptional*string#
[Security configuration](https://docs.docker.com/engine/reference/run/#security-configuration) when running the docker container.

Default: no security options

useroptionalstringuseroptionalstruseroptionalStringUseroptionalstringUseroptional*string#
The user to use when running the container.

Default: root or image default

volumesoptionalDockerVolume[]volumesoptionaltyping.List[DockerVolume]volumesoptionalList<DockerVolume>VolumesoptionalDockerVolume[]Volumesoptional*[]DockerVolume#
Docker volumes to mount.

Default: no volumes are mounted

volumesFromoptionalstring[]volumes_fromoptionaltyping.List[str]volumesFromoptionalList<String>VolumesFromoptionalstring[]VolumesFromoptional*[]*string#
Where to mount the specified volumes from.

Default: no containers are specified to mount volumes from

workingDirectoryoptionalstringworking_directoryoptionalstrworkingDirectoryoptionalStringWorkingDirectoryoptionalstringWorkingDirectoryoptional*string#
Working directory inside the container.

Default: image default