private void layerEntriesDo(BiConsumer<String, TarArchiveEntry> layerConsumer)
      throws IOException {

    try (TarArchiveInputStream input =
        new TarArchiveInputStream(Files.newInputStream(imageTar.toPath()))) {
      TarArchiveEntry imageEntry;
      while ((imageEntry = input.getNextTarEntry()) != null) {
        String imageEntryName = imageEntry.getName();
        // assume all .tar.gz files are layers
        if (imageEntry.isFile() && imageEntryName.endsWith(".tar.gz")) {
          @SuppressWarnings("resource") // must not close sub-streams
          TarArchiveInputStream layer = new TarArchiveInputStream(new GZIPInputStream(input));
          TarArchiveEntry layerEntry;
          while ((layerEntry = layer.getNextTarEntry()) != null) {
            layerConsumer.accept(imageEntryName, layerEntry);
          }
        }
      }
    }
  }
Verify that created image has explicit directory structures, default timestamps, permissions, and
file orderings.
jib-core/src/integration-test/java/com/google/cloud/tools/jib/api/ReproducibleImageTest.java