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
ConstructorsModifierConstructorDescriptionprotected
protected
ContainerImage
(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protected
ContainerImage
(software.amazon.jsii.JsiiObjectRef objRef) -
Method Summary
Modifier and TypeMethodDescriptionabstract ContainerImageConfig
bind
(Construct scope, ContainerDefinition containerDefinition) Called when the image is used by a ContainerDefinition.static AssetImage
Reference an image that's constructed directly from sources on disk.static AssetImage
fromAsset
(String directory, AssetImageProps props) Reference an image that's constructed directly from sources on disk.static ContainerImage
Use an existingDockerImageAsset
for this container image.static EcrImage
fromEcrRepository
(IRepository repository) Reference an image in an ECR repository.static EcrImage
fromEcrRepository
(IRepository repository, String tag) Reference an image in an ECR repository.static RepositoryImage
fromRegistry
(String name) Reference an image on DockerHub or another online registry.static RepositoryImage
fromRegistry
(String name, RepositoryImageProps props) Reference an image on DockerHub or another online registry.static ContainerImage
fromTarball
(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, jsiiStaticSet
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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
DockerImageAsset
instance, you can use theContainerImage.fromDockerImageAsset
method 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
DockerImageAsset
instance, you can use theContainerImage.fromDockerImageAsset
method 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 existingDockerImageAsset
for this container image.- Parameters:
asset
- TheDockerImageAsset
to 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.
-