Skip to content
v2.274.0

DockerImageCode Class ​

Code property for the DockerImageFunction construct.

Example ​

ts
new lambda.DockerImageFunction(this, 'AssetFunction', {
  code: lambda.DockerImageCode.fromImageAsset(path.join(__dirname, 'docker-arm64-handler')),
  architecture: lambda.Architecture.ARM_64,
});

Initializer ​

ts
new DockerImageCode()
python
DockerImageCode()
java
new DockerImageCode()
csharp
new DockerImageCode()
go
NewDockerImageCode()

Methods ​

fromEcr(repository: IRepository, props?: EcrImageCodeProps): DockerImageCode // chainable@staticmethod def from_ecr(repository: IRepository, props: typing.Optional[EcrImageCodeProps] = None) -> DockerImageCodepublic static DockerImageCode fromEcr(IRepository repository, EcrImageCodeProps props)public static DockerImageCode FromEcr(IRepository repository, EcrImageCodeProps? props = null)func FromEcr(Repository IRepository, Props EcrImageCodeProps) DockerImageCodestatic#
Use an existing ECR image as the Lambda code.
2 parameters

Parameters

  • repositoryrepositoryrepositoryrepositoryRepository — the ECR repository that the image is in.
  • propspropspropspropsProps — properties to further configure the selected image.
fromImageAsset(directory: string, props?: AssetImageCodeProps): DockerImageCode // chainable@staticmethod def from_image_asset(directory: str, props: typing.Optional[AssetImageCodeProps] = None) -> DockerImageCodepublic static DockerImageCode fromImageAsset(String directory, AssetImageCodeProps props)public static DockerImageCode FromImageAsset(string directory, AssetImageCodeProps? props = null)func FromImageAsset(Directory *string, Props AssetImageCodeProps) DockerImageCodestatic#
Create an ECR image from the specified asset and bind it as the Lambda code.
2 parameters

Parameters

  • directorydirectorydirectorydirectoryDirectory — the directory from which the asset must be created.
  • propspropspropspropsProps — properties to further configure the selected image.