labs

This lab has been modernised but not yet verified end to end. Tell us if something breaks.

Golden Image Libraries

50 dkdockerView on GitHub

Lab Solution

The Dockerfile is a simple update to use the golden image in the final stage:

The POM should be updated so that Micrometer uses an explicit version instead of a range, and the JAR plugin uses the latest:

  • lab/pom.xml - uses the latest versions at the time of writing 🙂

You can build the sample solution with a new tag:

docker build -t app-3:v2 ./labs/golden-images/lab/

Check the app images:

docker image ls app-3

In one run the v2 image came out around 30% smaller (your numbers will differ):

REPOSITORY   TAG       IMAGE ID       CREATED         SIZE
app-3        v1        90f85a6e8be0   2 minutes ago   221MB
app-3        v2        cbc2c31a0685   2 minutes ago   184MB

And if you inspect the images to see the layers:

docker inspect app-3:v1

docker inspect app-3:v2

You'll see v1 has a different set of layers - no commonality with any of the other Java apps we've built. v2 shares the same base layers as the v2 images from app-1 and app-2, so we're maximizing the layer cache as well as enforcing an approved base image.


Back to the exercises.