# DockerImage

Creates `IDockerImage` instances.

- Source: [`aws-stepfunctions-tasks/lib/sagemaker/base-types.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-stepfunctions-tasks/lib/sagemaker/base-types.ts#L354)
- Type last changed: v2.21.0 · 22 Apr 2022

## 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()
```

## Methods

- `bind(task: ISageMakerTask): DockerImageConfig` — Called when the image is used by a SageMaker task.

- `fromAsset(scope: Construct, id: string, props: DockerImageAssetProps): DockerImage // chainable` (static) — Reference a Docker image that is provided as an Asset in the current app.

  **Parameters**

  - `scope` — the scope in which to create the Asset.
  - `id` — the ID for the asset in the construct tree.
  - `props` — the configuration props of the asset.

- `fromEcrRepository(repository: IRepository, tagOrDigest?: string): DockerImage // chainable` (static) — Reference a Docker image stored in an ECR repository.

  **Parameters**

  - `repository` — the ECR repository where the image is hosted.
  - `tagOrDigest` — an optional tag or digest (digests must start with `sha256:`).

- `fromJsonExpression(expression: string, allowAnyEcrImagePull?: boolean): DockerImage // chainable` (static) — Reference a Docker image which URI is obtained from the task's input.

  **Parameters**

  - `expression` — the JSONata or JSON path expression with the task input.
  - `allowAnyEcrImagePull` — whether ECR access should be permitted (set to `false` if the image will never be in ECR).

- `fromRegistry(imageUri: string): DockerImage // chainable` (static) — Reference a Docker image by it's URI.

  When referencing ECR images, prefer using `inEcr`.

  **Parameters**

  - `imageUri` — the URI to the docker image.
