@Override
  public void save(
      ImageReference imageReference, Path outputPath, Consumer<Long> writtenByteCountListener)
      throws InterruptedException, IOException {
    Process dockerProcess = docker("save", imageReference.toString());

    try (InputStream stdout = new BufferedInputStream(dockerProcess.getInputStream());
        OutputStream fileStream = new BufferedOutputStream(Files.newOutputStream(outputPath));
        NotifyingOutputStream notifyingFileStream =
            new NotifyingOutputStream(fileStream, writtenByteCountListener)) {
      ByteStreams.copy(stdout, notifyingFileStream);
    }

    if (dockerProcess.waitFor() != 0) {
      throw new IOException(
          "'docker save' command failed with error: " + getStderrOutput(dockerProcess));
    }
  }
Instantiates with a {@code docker} executable and environment variables.

@param dockerExecutable path to {@code docker}
@param dockerEnvironment environment variables for {@code docker}
jib-core/src/main/java/com/google/cloud/tools/jib/docker/CliDockerClient.java