Class DockerImage

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

@Generated(value="jsii-pacmak/1.99.0 (build 8f757e4)", date="2024-06-13T18:49:13.283Z") @Stability(Stable) public class DockerImage extends software.amazon.jsii.JsiiObject
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.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 - The Docker image. This parameter is required.
      _imageHash -
    • DockerImage

      @Stability(Stable) public DockerImage(@NotNull String image)
      Parameters:
      image - The Docker 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.

      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.

      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.

      Parameters:
      options -
    • run

      @Stability(Stable) public void run()
      Runs a Docker image.
    • toJSON

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

      Returns:
      The overridden image name if set or image hash name in that order
    • getImage

      @Stability(Stable) @NotNull public String getImage()
      The Docker image.