Class DockerImage
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
Properties
Image
The Docker image.
public override string Image { get; }
Property Value
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
stringthe path in the Docker image.
outputPath
stringthe 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
stringThe path to the directory containing the Docker file.
options
IDockerBuildOptionsDocker build options.
Returns
FromRegistry(string)
Reference an image on DockerHub or another online registry.
public static DockerImage FromRegistry(string image)
Parameters
image
stringthe image name.
Returns
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