String buildStream = consumeStream(buildImageStream, false);
Iterable<String> splitted = Splitter.on("\n").split(buildStream.replace("\r", "").trim());
String lastStreamedLine = Iterables.getLast(splitted).trim();
String rawImageId = Iterables.getLast(Splitter.on("Successfully built ").split(lastStreamedLine));
String imageId = rawImageId.substring(0, 11);
Image image = api().inspectImage(imageId);
api().deleteImage(image.getId(), DeleteImageOptions.Builder.force(true));
}