DockerImage

class aws_cdk.aws_stepfunctions_tasks.DockerImage

Bases: object

Creates IDockerImage instances.

ExampleMetadata:

infused

Example:

tasks.SageMakerCreateModel(self, "Sagemaker",
    model_name="MyModel",
    primary_container=tasks.ContainerDefinition(
        image=tasks.DockerImage.from_json_expression(sfn.JsonPath.string_at("$.Model.imageName")),
        mode=tasks.Mode.SINGLE_MODEL,
        model_s3_location=tasks.S3Location.from_json_expression("$.TrainingJob.ModelArtifacts.S3ModelArtifacts")
    )
)

Methods

abstract bind(task)

Called when the image is used by a SageMaker task.

Parameters:

task (ISageMakerTask) –

Return type:

DockerImageConfig

Static Methods

classmethod from_asset(scope, id, *, directory, build_args=None, file=None, invalidation=None, network_mode=None, platform=None, repository_name=None, target=None, extra_hash=None, exclude=None, follow=None, ignore_mode=None, follow_symlinks=None)

Reference a Docker image that is provided as an Asset in the current app.

Parameters:
  • scope (Construct) – the scope in which to create the Asset.

  • id (str) – the ID for the asset in the construct tree.

  • directory (str) – The directory where the Dockerfile is stored. Any directory inside with a name that matches the CDK output folder (cdk.out by default) will be excluded from the asset

  • build_args (Optional[Mapping[str, str]]) – Build args to pass to the docker build command. Since Docker build arguments are resolved before deployment, keys and values cannot refer to unresolved tokens (such as lambda.functionArn or queue.queueUrl). Default: - no build args are passed

  • file (Optional[str]) – Path to the Dockerfile (relative to the directory). Default: ‘Dockerfile’

  • invalidation (Union[DockerImageAssetInvalidationOptions, Dict[str, Any], None]) – Options to control which parameters are used to invalidate the asset hash. Default: - hash all parameters

  • network_mode (Optional[NetworkMode]) – Networking mode for the RUN commands during build. Support docker API 1.25+. Default: - no networking mode specified (the default networking mode NetworkMode.DEFAULT will be used)

  • platform (Optional[Platform]) – Platform to build for. Requires Docker Buildx. Default: - no platform specified (the current machine architecture will be used)

  • repository_name (Optional[str]) – (deprecated) ECR repository name. Specify this property if you need to statically address the image, e.g. from a Kubernetes Pod. Note, this is only the repository name, without the registry and the tag parts. Default: - the default ECR repository for CDK assets

  • target (Optional[str]) – Docker target to build to. Default: - no target

  • extra_hash (Optional[str]) – (deprecated) Extra information to encode into the fingerprint (e.g. build instructions and other inputs). Default: - hash is only based on source content

  • exclude (Optional[Sequence[str]]) – (deprecated) Glob patterns to exclude from the copy. Default: nothing is excluded

  • follow (Optional[FollowMode]) – (deprecated) A strategy for how to handle symlinks. Default: Never

  • ignore_mode (Optional[IgnoreMode]) – (deprecated) The ignore behavior to use for exclude patterns. Default: - GLOB for file assets, DOCKER or GLOB for docker assets depending on whether the ‘

  • follow_symlinks (Optional[SymlinkFollowMode]) – A strategy for how to handle symlinks. Default: SymlinkFollowMode.NEVER

Return type:

DockerImage

classmethod from_ecr_repository(repository, tag_or_digest=None)

Reference a Docker image stored in an ECR repository.

Parameters:
  • repository (IRepository) – the ECR repository where the image is hosted.

  • tag_or_digest (Optional[str]) – an optional tag or digest (digests must start with sha256:).

Return type:

DockerImage

classmethod from_json_expression(expression, allow_any_ecr_image_pull=None)

Reference a Docker image which URI is obtained from the task’s input.

Parameters:
  • expression (str) – the JSON path expression with the task input.

  • allow_any_ecr_image_pull (Optional[bool]) – whether ECR access should be permitted (set to false if the image will never be in ECR).

Return type:

DockerImage

classmethod from_registry(image_uri)

Reference a Docker image by it’s URI.

When referencing ECR images, prefer using inEcr.

Parameters:

image_uri (str) – the URI to the docker image.

Return type:

DockerImage