Table of Contents

Class DockerImage

Namespace
Amazon.CDK
Assembly
Amazon.CDK.dll

A Docker image.

public class DockerImage : BundlingDockerImage
Inheritance
DockerImage
Inherited Members

Examples

var entry = "/path/to/function";
            var image = DockerImage.FromBuild(entry);

            new PythonFunction(this, "function", new PythonFunctionProps {
                Entry = entry,
                Runtime = Runtime.PYTHON_3_8,
                Bundling = new BundlingOptions {
                    BuildArgs = new Dictionary<string, string> { { "PIP_INDEX_URL", "https://your.index.url/simple/" }, { "PIP_EXTRA_INDEX_URL", "https://your.extra-index.url/simple/" } }
                }
            });

Remarks

ExampleMetadata: infused

Constructors

DockerImage(string, string?)

public DockerImage(string image, string? imageHash = null)

Parameters

image string
imageHash string

Properties

Image

The Docker image.

public override string Image { get; }

Property Value

string

Methods

Cp(string, string?)

Copies a file or directory out of the Docker image to the local filesystem.

public override string Cp(string imagePath, string? outputPath = null)

Parameters

imagePath string

the path in the Docker image.

outputPath string

the destination path for the copy operation.

Returns

string

the destination path

Remarks

If outputPath is omitted the destination path is a temporary directory.

FromBuild(string, IDockerBuildOptions?)

Builds a Docker image.

public static DockerImage FromBuild(string path, IDockerBuildOptions? options = null)

Parameters

path string

The path to the directory containing the Docker file.

options IDockerBuildOptions

Docker build options.

Returns

DockerImage

FromRegistry(string)

Reference an image on DockerHub or another online registry.

public static DockerImage FromRegistry(string image)

Parameters

image string

the image name.

Returns

DockerImage

Run(IDockerRunOptions?)

Runs a Docker image.

public override void Run(IDockerRunOptions? options = null)

Parameters

options IDockerRunOptions

ToJSON()

Provides a stable representation of this image for JSON serialization.

public override string ToJSON()

Returns

string

The overridden image name if set or image hash name in that order