Class ContainerImage
java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.ecs.ContainerImage
- All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable
- Direct Known Subclasses:
AssetImage,EcrImage,RepositoryImage,TagParameterContainerImage
@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)",
date="2023-06-19T16:30:47.277Z")
@Stability(Stable)
public abstract class ContainerImage
extends software.amazon.jsii.JsiiObject
Constructs for types of container images.
Example:
Vpc vpc;
Cluster cluster = Cluster.Builder.create(this, "FargateCPCluster")
.vpc(vpc)
.enableFargateCapacityProviders(true)
.build();
FargateTaskDefinition taskDefinition = new FargateTaskDefinition(this, "TaskDef");
taskDefinition.addContainer("web", ContainerDefinitionOptions.builder()
.image(ContainerImage.fromRegistry("amazon/amazon-ecs-sample"))
.build());
FargateService.Builder.create(this, "FargateService")
.cluster(cluster)
.taskDefinition(taskDefinition)
.capacityProviderStrategies(List.of(CapacityProviderStrategy.builder()
.capacityProvider("FARGATE_SPOT")
.weight(2)
.build(), CapacityProviderStrategy.builder()
.capacityProvider("FARGATE")
.weight(1)
.build()))
.build();
-
Nested Class Summary
Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationMode -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedprotectedContainerImage(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedContainerImage(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptionabstract ContainerImageConfigbind(Construct scope, ContainerDefinition containerDefinition) Called when the image is used by a ContainerDefinition.static AssetImageReference an image that's constructed directly from sources on disk.static AssetImagefromAsset(String directory, AssetImageProps props) Reference an image that's constructed directly from sources on disk.static ContainerImageUse an existingDockerImageAssetfor this container image.static EcrImagefromEcrRepository(IRepository repository) Reference an image in an ECR repository.static EcrImagefromEcrRepository(IRepository repository, String tag) Reference an image in an ECR repository.static RepositoryImagefromRegistry(String name) Reference an image on DockerHub or another online registry.static RepositoryImagefromRegistry(String name, RepositoryImageProps props) Reference an image on DockerHub or another online registry.static ContainerImagefromTarball(String tarballFile) Use an existing tarball for this container image.Methods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Constructor Details
-
ContainerImage
protected ContainerImage(software.amazon.jsii.JsiiObjectRef objRef) -
ContainerImage
protected ContainerImage(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
ContainerImage
@Stability(Stable) protected ContainerImage()
-
-
Method Details
-
fromAsset
@Stability(Stable) @NotNull public static AssetImage fromAsset(@NotNull String directory, @Nullable AssetImageProps props) Reference an image that's constructed directly from sources on disk.If you already have a
DockerImageAssetinstance, you can use theContainerImage.fromDockerImageAssetmethod instead.- Parameters:
directory- The directory containing the Dockerfile. This parameter is required.props-
-
fromAsset
Reference an image that's constructed directly from sources on disk.If you already have a
DockerImageAssetinstance, you can use theContainerImage.fromDockerImageAssetmethod instead.- Parameters:
directory- The directory containing the Dockerfile. This parameter is required.
-
fromDockerImageAsset
@Stability(Stable) @NotNull public static ContainerImage fromDockerImageAsset(@NotNull DockerImageAsset asset) Use an existingDockerImageAssetfor this container image.- Parameters:
asset- TheDockerImageAssetto use for this container definition. This parameter is required.
-
fromEcrRepository
@Stability(Stable) @NotNull public static EcrImage fromEcrRepository(@NotNull IRepository repository, @Nullable String tag) Reference an image in an ECR repository.- Parameters:
repository- This parameter is required.tag-
-
fromEcrRepository
@Stability(Stable) @NotNull public static EcrImage fromEcrRepository(@NotNull IRepository repository) Reference an image in an ECR repository.- Parameters:
repository- This parameter is required.
-
fromRegistry
@Stability(Stable) @NotNull public static RepositoryImage fromRegistry(@NotNull String name, @Nullable RepositoryImageProps props) Reference an image on DockerHub or another online registry.- Parameters:
name- This parameter is required.props-
-
fromRegistry
Reference an image on DockerHub or another online registry.- Parameters:
name- This parameter is required.
-
fromTarball
Use an existing tarball for this container image.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.
- Parameters:
tarballFile- Absolute path to the tarball. This parameter is required.
-
bind
@Stability(Stable) @NotNull public abstract ContainerImageConfig bind(@NotNull Construct scope, @NotNull ContainerDefinition containerDefinition) Called when the image is used by a ContainerDefinition.- Parameters:
scope- This parameter is required.containerDefinition- This parameter is required.
-