Show / Hide Table of Contents

Class ContainerImage

Constructs for types of container images.

Inheritance
System.Object
ContainerImage
AssetImage
EcrImage
RepositoryImage
TagParameterContainerImage
Namespace: Amazon.CDK.AWS.ECS
Assembly: Amazon.CDK.AWS.ECS.dll
Syntax (csharp)
public abstract class ContainerImage : DeputyBase
Syntax (vb)
Public MustInherit Class ContainerImage
    Inherits DeputyBase
Remarks

ExampleMetadata: infused

Examples
Vpc vpc;


var cluster = new Cluster(this, "FargateCPCluster", new ClusterProps {
    Vpc = vpc,
    EnableFargateCapacityProviders = true
});

var taskDefinition = new FargateTaskDefinition(this, "TaskDef");

taskDefinition.AddContainer("web", new ContainerDefinitionOptions {
    Image = ContainerImage.FromRegistry("amazon/amazon-ecs-sample")
});

new FargateService(this, "FargateService", new FargateServiceProps {
    Cluster = cluster,
    TaskDefinition = taskDefinition,
    CapacityProviderStrategies = new [] { new CapacityProviderStrategy {
        CapacityProvider = "FARGATE_SPOT",
        Weight = 2
    }, new CapacityProviderStrategy {
        CapacityProvider = "FARGATE",
        Weight = 1
    } }
});

Synopsis

Constructors

ContainerImage()
ContainerImage(ByRefValue)

Used by jsii to construct an instance of this class from a Javascript-owned object reference

ContainerImage(DeputyBase.DeputyProps)

Used by jsii to construct an instance of this class from DeputyProps

Methods

Bind(Construct, ContainerDefinition)

Called when the image is used by a ContainerDefinition.

FromAsset(String, IAssetImageProps)

Reference an image that's constructed directly from sources on disk.

FromDockerImageAsset(DockerImageAsset)

Use an existing DockerImageAsset for this container image.

FromEcrRepository(IRepository, String)

Reference an image in an ECR repository.

FromRegistry(String, IRepositoryImageProps)

Reference an image on DockerHub or another online registry.

FromTarball(String)

Use an existing tarball for this container image.

Constructors

ContainerImage()

protected ContainerImage()

ContainerImage(ByRefValue)

Used by jsii to construct an instance of this class from a Javascript-owned object reference

protected ContainerImage(ByRefValue reference)
Parameters
reference Amazon.JSII.Runtime.Deputy.ByRefValue

The Javascript-owned object reference

ContainerImage(DeputyBase.DeputyProps)

Used by jsii to construct an instance of this class from DeputyProps

protected ContainerImage(DeputyBase.DeputyProps props)
Parameters
props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps

The deputy props

Methods

Bind(Construct, ContainerDefinition)

Called when the image is used by a ContainerDefinition.

public abstract IContainerImageConfig Bind(Construct scope, ContainerDefinition containerDefinition)
Parameters
scope Construct
containerDefinition ContainerDefinition
Returns

IContainerImageConfig

FromAsset(String, IAssetImageProps)

Reference an image that's constructed directly from sources on disk.

public static AssetImage FromAsset(string directory, IAssetImageProps props = null)
Parameters
directory System.String

The directory containing the Dockerfile.

props IAssetImageProps

The directory containing the Dockerfile.

Returns

AssetImage

Remarks

If you already have a DockerImageAsset instance, you can use the ContainerImage.fromDockerImageAsset method instead.

FromDockerImageAsset(DockerImageAsset)

Use an existing DockerImageAsset for this container image.

public static ContainerImage FromDockerImageAsset(DockerImageAsset asset)
Parameters
asset DockerImageAsset

The DockerImageAsset to use for this container definition.

Returns

ContainerImage

FromEcrRepository(IRepository, String)

Reference an image in an ECR repository.

public static EcrImage FromEcrRepository(IRepository repository, string tag = null)
Parameters
repository IRepository
tag System.String
Returns

EcrImage

FromRegistry(String, IRepositoryImageProps)

Reference an image on DockerHub or another online registry.

public static RepositoryImage FromRegistry(string name, IRepositoryImageProps props = null)
Parameters
name System.String
props IRepositoryImageProps
Returns

RepositoryImage

FromTarball(String)

Use an existing tarball for this container image.

public static ContainerImage FromTarball(string tarballFile)
Parameters
tarballFile System.String

Absolute path to the tarball.

Returns

ContainerImage

Remarks

Use this method if the container image has already been created by another process (e.g. jib) and you want to add it as a container image asset.

Back to top Generated by DocFX