public static Image toImage(V21ManifestTemplate manifestTemplate)
      throws LayerPropertyNotFoundException, BadContainerConfigurationFormatException {
    Image.Builder imageBuilder = Image.builder(V21ManifestTemplate.class);

    // V21 layers are in reverse order of V22. (The first layer is the latest one.)
    for (DescriptorDigest digest : Lists.reverse(manifestTemplate.getLayerDigests())) {
      imageBuilder.addLayer(new DigestOnlyLayer(digest));
    }

    Optional<ContainerConfigurationTemplate> configuration =
        manifestTemplate.getContainerConfiguration();
    if (configuration.isPresent()) {
      configureBuilderWithContainerConfiguration(imageBuilder, configuration.get());
    }
    return imageBuilder.build();
  }
Translates {@link V21ManifestTemplate} to {@link Image}.

@param manifestTemplate the template containing the image layers.
@return the translated {@link Image}.
@throws LayerPropertyNotFoundException if adding image layers fails.
@throws BadContainerConfigurationFormatException if the container configuration is in a bad
    format
jib-core/src/main/java/com/google/cloud/tools/jib/image/json/JsonToImageTranslator.java