class DockerImage
Language | Type name |
---|---|
.NET | Amazon.CDK.DockerImage |
Go | github.com/aws/aws-cdk-go/awscdk/v2#DockerImage |
Java | software.amazon.awscdk.DockerImage |
Python | aws_cdk.DockerImage |
TypeScript (source) | aws-cdk-lib » DockerImage |
A Docker image.
Example
const entry = '/path/to/function';
const image = DockerImage.fromBuild(entry);
new python.PythonFunction(this, 'function', {
entry,
runtime: Runtime.PYTHON_3_8,
bundling: {
buildArgs: { PIP_INDEX_URL: "https://your.index.url/simple/", PIP_EXTRA_INDEX_URL: "https://your.extra-index.url/simple/" },
},
});
Initializer
new DockerImage(image: string, _imageHash?: string)
Parameters
- image
string
— The Docker image. - _imageHash
string
Properties
Name | Type | Description |
---|---|---|
image | string | The Docker image. |
image
Type:
string
The Docker image.
Methods
Name | Description |
---|---|
cp(imagePath, outputPath?) | Copies a file or directory out of the Docker image to the local filesystem. |
run(options?) | Runs a Docker image. |
to | Provides a stable representation of this image for JSON serialization. |
static from | Builds a Docker image. |
static from | Reference an image on DockerHub or another online registry. |
cp(imagePath, outputPath?)
public cp(imagePath: string, outputPath?: string): string
Parameters
- imagePath
string
— the path in the Docker image. - outputPath
string
— the destination path for the copy operation.
Returns
string
Copies a file or directory out of the Docker image to the local filesystem.
If outputPath
is omitted the destination path is a temporary directory.
run(options?)
public run(options?: DockerRunOptions): void
Parameters
- options
Docker
Run Options
Runs a Docker image.
JSON()
topublic toJSON(): string
Returns
string
Provides a stable representation of this image for JSON serialization.
Build(path, options?)
static frompublic static fromBuild(path: string, options?: DockerBuildOptions): DockerImage
Parameters
- path
string
— The path to the directory containing the Docker file. - options
Docker
— Docker build options.Build Options
Returns
Builds a Docker image.
Registry(image)
static frompublic static fromRegistry(image: string): DockerImage
Parameters
- image
string
— the image name.
Returns
Reference an image on DockerHub or another online registry.