Interface DockerClient

  • All Known Implementing Classes:
    CliDockerClient

    public interface DockerClient
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      ImageDetails inspect​(ImageReference imageReference)
      Gets the size, image ID, and diff IDs of an image in the Docker daemon.
      java.lang.String load​(ImageTarball imageTarball, java.util.function.Consumer<java.lang.Long> writtenByteCountListener)
      Loads an image tarball into the Docker daemon.
      void save​(ImageReference imageReference, java.nio.file.Path outputPath, java.util.function.Consumer<java.lang.Long> writtenByteCountListener)
      Saves an image tarball from the Docker daemon.
      boolean supported​(java.util.Map<java.lang.String,​java.lang.String> parameters)
      Validate if the DockerClient is supported.
    • Method Detail

      • supported

        boolean supported​(java.util.Map<java.lang.String,​java.lang.String> parameters)
        Validate if the DockerClient is supported.
        Parameters:
        parameters - to be used by the docker client
        Returns:
        true if conditions are met
      • load

        java.lang.String load​(ImageTarball imageTarball,
                              java.util.function.Consumer<java.lang.Long> writtenByteCountListener)
                       throws java.lang.InterruptedException,
                              java.io.IOException
        Loads an image tarball into the Docker daemon.
        Parameters:
        imageTarball - the built container tarball
        writtenByteCountListener - callback to call when bytes are loaded
        Returns:
        stdout from docker
        Throws:
        java.lang.InterruptedException - if the 'docker load' process is interrupted
        java.io.IOException - if streaming the blob to 'docker load' fails
        See Also:
        https://docs.docker.com/engine/reference/commandline/load
      • save

        void save​(ImageReference imageReference,
                  java.nio.file.Path outputPath,
                  java.util.function.Consumer<java.lang.Long> writtenByteCountListener)
           throws java.lang.InterruptedException,
                  java.io.IOException
        Saves an image tarball from the Docker daemon.
        Parameters:
        imageReference - the image to save
        outputPath - the destination path to save the output tarball
        writtenByteCountListener - callback to call when bytes are saved
        Throws:
        java.lang.InterruptedException - if the 'docker save' process is interrupted
        java.io.IOException - if creating the tarball fails
        See Also:
        https://docs.docker.com/engine/reference/commandline/save
      • inspect

        ImageDetails inspect​(ImageReference imageReference)
                      throws java.io.IOException,
                             java.lang.InterruptedException
        Gets the size, image ID, and diff IDs of an image in the Docker daemon.
        Parameters:
        imageReference - the image to inspect
        Returns:
        the size, image ID, and diff IDs of the image
        Throws:
        java.io.IOException - if an I/O exception occurs or docker inspect failed
        java.lang.InterruptedException - if the docker inspect process was interrupted