Class DockerImage

java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.core.BundlingDockerImage
software.amazon.awscdk.core.DockerImage
All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:29:55.023Z") @Stability(Stable) public class DockerImage extends BundlingDockerImage
A Docker image.

Example:

 String entry = "/path/to/function";
 DockerImage image = DockerImage.fromBuild(entry);
 PythonFunction.Builder.create(this, "function")
         .entry(entry)
         .runtime(Runtime.PYTHON_3_8)
         .bundling(BundlingOptions.builder()
                 .buildArgs(Map.of("PIP_INDEX_URL", "https://your.index.url/simple/", "PIP_EXTRA_INDEX_URL", "https://your.extra-index.url/simple/"))
                 .build())
         .build();
 
  • Nested Class Summary

    Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject

    software.amazon.jsii.JsiiObject.InitializationMode
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
     
     
     
    DockerImage(String image, String _imageHash)
     
    protected
    DockerImage(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
     
    protected
    DockerImage(software.amazon.jsii.JsiiObjectRef objRef)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    cp(String imagePath)
    Copies a file or directory out of the Docker image to the local filesystem.
    cp(String imagePath, String outputPath)
    Copies a file or directory out of the Docker image to the local filesystem.
    Builds a Docker image.
    Builds a Docker image.
    Reference an image on DockerHub or another online registry.
    The Docker image.
    void
    run()
    Runs a Docker image.
    void
    Runs a Docker image.
    Provides a stable representation of this image for JSON serialization.

    Methods inherited from class software.amazon.awscdk.core.BundlingDockerImage

    fromAsset, fromAsset

    Methods inherited from class software.amazon.jsii.JsiiObject

    jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface software.amazon.jsii.JsiiSerializable

    $jsii$toJson
  • Constructor Details

    • DockerImage

      protected DockerImage(software.amazon.jsii.JsiiObjectRef objRef)
    • DockerImage

      protected DockerImage(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • DockerImage

      @Stability(Stable) public DockerImage(@NotNull String image, @Nullable String _imageHash)
      Parameters:
      image - This parameter is required.
      _imageHash -
    • DockerImage

      @Stability(Stable) public DockerImage(@NotNull String image)
      Parameters:
      image - This parameter is required.
  • Method Details

    • fromBuild

      @Stability(Stable) @NotNull public static DockerImage fromBuild(@NotNull String path, @Nullable DockerBuildOptions options)
      Builds a Docker image.

      Parameters:
      path - The path to the directory containing the Docker file. This parameter is required.
      options - Docker build options.
    • fromBuild

      @Stability(Stable) @NotNull public static DockerImage fromBuild(@NotNull String path)
      Builds a Docker image.

      Parameters:
      path - The path to the directory containing the Docker file. This parameter is required.
    • fromRegistry

      @Stability(Stable) @NotNull public static DockerImage fromRegistry(@NotNull String image)
      Reference an image on DockerHub or another online registry.

      Parameters:
      image - the image name. This parameter is required.
    • cp

      @Stability(Stable) @NotNull public String cp(@NotNull String imagePath, @Nullable String outputPath)
      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.

      Overrides:
      cp in class BundlingDockerImage
      Parameters:
      imagePath - the path in the Docker image. This parameter is required.
      outputPath - the destination path for the copy operation.
      Returns:
      the destination path
    • cp

      @Stability(Stable) @NotNull public String cp(@NotNull String imagePath)
      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.

      Overrides:
      cp in class BundlingDockerImage
      Parameters:
      imagePath - the path in the Docker image. This parameter is required.
      Returns:
      the destination path
    • run

      @Stability(Stable) public void run(@Nullable DockerRunOptions options)
      Runs a Docker image.

      Overrides:
      run in class BundlingDockerImage
      Parameters:
      options -
    • run

      @Stability(Stable) public void run()
      Runs a Docker image.
      Overrides:
      run in class BundlingDockerImage
    • toJSON

      @Stability(Stable) @NotNull public String toJSON()
      Provides a stable representation of this image for JSON serialization.

      Overrides:
      toJSON in class BundlingDockerImage
      Returns:
      The overridden image name if set or image hash name in that order
    • getImage

      @Stability(Stable) @NotNull public String getImage()
      The Docker image.
      Overrides:
      getImage in class BundlingDockerImage