DockerImage Class
Creates IDockerImage instances.
Example
ts
new tasks.SageMakerCreateModel(this, 'Sagemaker', {
modelName: 'MyModel',
primaryContainer: new tasks.ContainerDefinition({
image: tasks.DockerImage.fromJsonExpression(sfn.JsonPath.stringAt('$.Model.imageName')),
mode: tasks.Mode.SINGLE_MODEL,
modelS3Location: tasks.S3Location.fromJsonExpression('$.TrainingJob.ModelArtifacts.S3ModelArtifacts'),
}),
});
Initializer
ts
new DockerImage()
python
DockerImage()
java
new DockerImage()
csharp
new DockerImage()
go
NewDockerImage()
Methods
bind(task: ISageMakerTask): DockerImageConfigdef bind(self, task: ISageMakerTask) -> DockerImageConfigpublic DockerImageConfig bind(ISageMakerTask task)public DockerImageConfig Bind(ISageMakerTask task)func Bind(Task ISageMakerTask) DockerImageConfig#Called when the image is used by a SageMaker task.
fromAsset(scope: Construct, id: string, props: DockerImageAssetProps): DockerImage // chainable@staticmethod def from_asset(scope: Construct, id: str, props: DockerImageAssetProps) -> DockerImagepublic static DockerImage fromAsset(Construct scope, String id, DockerImageAssetProps props)public static DockerImage FromAsset(Construct scope, string id, DockerImageAssetProps props)func FromAsset(Scope Construct, Id *string, Props DockerImageAssetProps) DockerImagestatic#Reference a Docker image that is provided as an Asset in the current app.
3 parameters
Parameters
scopescopescopescopeScope— the scope in which to create the Asset.ididididId— the ID for the asset in the construct tree.propspropspropspropsProps— the configuration props of the asset.
fromEcrRepository(repository: IRepository, tagOrDigest?: string): DockerImage // chainable@staticmethod def from_ecr_repository(repository: IRepository, tag_or_digest: typing.Optional[str] = None) -> DockerImagepublic static DockerImage fromEcrRepository(IRepository repository, String tagOrDigest)public static DockerImage FromEcrRepository(IRepository repository, string? tagOrDigest = null)func FromEcrRepository(Repository IRepository, TagOrDigest *string) DockerImagestatic#Reference a Docker image stored in an ECR repository.
2 parameters
Parameters
repositoryrepositoryrepositoryrepositoryRepository— the ECR repository where the image is hosted.tagOrDigesttag_or_digesttagOrDigesttagOrDigestTagOrDigest— an optional tag or digest (digests must start withsha256:).
fromJsonExpression(expression: string, allowAnyEcrImagePull?: boolean): DockerImage // chainable@staticmethod def from_json_expression(expression: str, allow_any_ecr_image_pull: typing.Optional[bool] = None) -> DockerImagepublic static DockerImage fromJsonExpression(String expression, Boolean allowAnyEcrImagePull)public static DockerImage FromJsonExpression(string expression, bool? allowAnyEcrImagePull = null)func FromJsonExpression(Expression *string, AllowAnyEcrImagePull *bool) DockerImagestatic#Reference a Docker image which URI is obtained from the task's input.
2 parameters
Parameters
expressionexpressionexpressionexpressionExpression— the JSONata or JSON path expression with the task input.allowAnyEcrImagePullallow_any_ecr_image_pullallowAnyEcrImagePullallowAnyEcrImagePullAllowAnyEcrImagePull— whether ECR access should be permitted (set tofalseif the image will never be in ECR).
fromRegistry(imageUri: string): DockerImage // chainable@staticmethod def from_registry(image_uri: str) -> DockerImagepublic static DockerImage fromRegistry(String imageUri)public static DockerImage FromRegistry(string imageUri)func FromRegistry(ImageUri *string) DockerImagestatic#Reference a Docker image by it's URI.
When referencing ECR images, prefer using inEcr.
1 parameter
Parameters
imageUriimage_uriimageUriimageUriImageUri— the URI to the docker image.