Class DockerImage
A Docker image.
Inheritance
Namespace: Amazon.CDK
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class DockerImage : DeputyBase
Syntax (vb)
Public Class DockerImage
Inherits DeputyBase
Remarks
ExampleMetadata: infused
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/" } }
}
});
Synopsis
Constructors
DockerImage(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
DockerImage(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
DockerImage(String, String) |
Properties
Image | The Docker image. |
Methods
Cp(String, String) | Copies a file or directory out of the Docker image to the local filesystem. |
FromBuild(String, IDockerBuildOptions) | Builds a Docker image. |
FromRegistry(String) | Reference an image on DockerHub or another online registry. |
Run(IDockerRunOptions) | Runs a Docker image. |
ToJSON() | Provides a stable representation of this image for JSON serialization. |
Constructors
DockerImage(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected DockerImage(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
DockerImage(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected DockerImage(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
DockerImage(String, String)
public DockerImage(string image, string imageHash = null)
Parameters
- image System.String
The Docker image.
- imageHash System.String
The Docker image.
Properties
Image
The Docker image.
public virtual string Image { get; }
Property Value
System.String
Methods
Cp(String, String)
Copies a file or directory out of the Docker image to the local filesystem.
public virtual string Cp(string imagePath, string outputPath = null)
Parameters
- imagePath System.String
the path in the Docker image.
- outputPath System.String
the destination path for the copy operation.
Returns
System.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 System.String
The path to the directory containing the Docker file.
- options IDockerBuildOptions
Docker build options.
Returns
FromRegistry(String)
Reference an image on DockerHub or another online registry.
public static DockerImage FromRegistry(string image)
Parameters
- image System.String
the image name.
Returns
Run(IDockerRunOptions)
Runs a Docker image.
public virtual void Run(IDockerRunOptions options = null)
Parameters
- options IDockerRunOptions
ToJSON()
Provides a stable representation of this image for JSON serialization.
public virtual string ToJSON()
Returns
System.String
The overridden image name if set or image hash name in that order