RepositoryImage
- class aws_cdk.aws_ecs.RepositoryImage(image_name, *, credentials=None)
Bases:
ContainerImage
An image hosted in a public or private repository.
For images hosted in Amazon ECR, see EcrImage.
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_ecr_assets as ecr_assets from aws_cdk import aws_ecs as ecs # docker_image_asset: ecr_assets.DockerImageAsset repository_image = ecs.RepositoryImage.from_docker_image_asset(docker_image_asset)
Constructs a new instance of the RepositoryImage class.
- Parameters:
image_name (
str
) –credentials (
Optional
[ISecret
]) – The secret to expose to the container that contains the credentials for the image repository. The supported value is the full ARN of an AWS Secrets Manager secret.
Methods
- bind(scope, container_definition)
Called when the image is used by a ContainerDefinition.
- Parameters:
scope (
Construct
) –container_definition (
ContainerDefinition
) –
- Return type:
Static Methods
- classmethod from_asset(directory, *, asset_name=None, build_args=None, build_secrets=None, build_ssh=None, cache_disabled=None, cache_from=None, cache_to=None, file=None, invalidation=None, network_mode=None, outputs=None, platform=None, target=None, extra_hash=None, exclude=None, follow_symlinks=None, ignore_mode=None)
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 (
str
) – The directory containing the Dockerfile.asset_name (
Optional
[str
]) – Unique identifier of the docker image asset and its potential revisions. Required if using AppScopedStagingSynthesizer. Default: - no asset namebuild_args (
Optional
[Mapping
[str
,str
]]) – Build args to pass to thedocker build
command. Since Docker build arguments are resolved before deployment, keys and values cannot refer to unresolved tokens (such aslambda.functionArn
orqueue.queueUrl
). Default: - no build args are passedbuild_secrets (
Optional
[Mapping
[str
,str
]]) – Build secrets. Docker BuildKit must be enabled to use build secrets. Default: - no build secretsbuild_ssh (
Optional
[str
]) – SSH agent socket or keys to pass to thedocker build
command. Docker BuildKit must be enabled to use the ssh flag Default: - no –ssh flagcache_disabled (
Optional
[bool
]) – Disable the cache and pass--no-cache
to thedocker build
command. Default: - cache is usedcache_from (
Optional
[Sequence
[Union
[DockerCacheOption
,Dict
[str
,Any
]]]]) – Cache from options to pass to thedocker build
command. Default: - no cache from options are passed to the build commandcache_to (
Union
[DockerCacheOption
,Dict
[str
,Any
],None
]) – Cache to options to pass to thedocker build
command. Default: - no cache to options are passed to the build commandfile (
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 parametersnetwork_mode (
Optional
[NetworkMode
]) – Networking mode for the RUN commands during build. Support docker API 1.25+. Default: - no networking mode specified (the default networking modeNetworkMode.DEFAULT
will be used)outputs (
Optional
[Sequence
[str
]]) – Outputs to pass to thedocker build
command. Default: - no outputs are passed to the build command (default outputs are used)platform (
Optional
[Platform
]) – Platform to build for. Requires Docker Buildx. Default: - no platform specified (the current machine architecture will be used)target (
Optional
[str
]) – Docker target to build to. Default: - no targetextra_hash (
Optional
[str
]) – Extra information to encode into the fingerprint (e.g. build instructions and other inputs). Default: - hash is only based on source contentexclude (
Optional
[Sequence
[str
]]) – File paths matching the patterns will be excluded. SeeignoreMode
to set the matching behavior. Has no effect on Assets bundled using thebundling
property. Default: - nothing is excludedfollow_symlinks (
Optional
[SymlinkFollowMode
]) – A strategy for how to handle symlinks. Default: SymlinkFollowMode.NEVERignore_mode (
Optional
[IgnoreMode
]) – The ignore behavior to use forexclude
patterns. Default: IgnoreMode.GLOB
- Return type:
- classmethod from_docker_image_asset(asset)
Use an existing
DockerImageAsset
for this container image.- Parameters:
asset (
DockerImageAsset
) – TheDockerImageAsset
to use for this container definition.- Return type:
- classmethod from_ecr_repository(repository, tag=None)
Reference an image in an ECR repository.
- Parameters:
repository (
IRepository
) –tag (
Optional
[str
]) – If you don’t specify this parameter,latest
is used as default.
- Return type:
- classmethod from_registry(name, *, credentials=None)
Reference an image on DockerHub or another online registry.
- Parameters:
name (
str
) –credentials (
Optional
[ISecret
]) – The secret to expose to the container that contains the credentials for the image repository. The supported value is the full ARN of an AWS Secrets Manager secret.
- Return type:
- classmethod from_tarball(tarball_file)
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:
tarball_file (
str
) – Absolute path to the tarball. You can use language-specific idioms (such as__dirname
in Node.js) to create an absolute path based on the current script running directory.- Return type: