This lab has been modernised but not yet verified end to end. Tell us if something breaks.
Building Container Images
Lab Solution
Here's a sample solution:
It just creates a working directory called /app in the container filesystem, and copies in the Java class file.
The class file and the Dockerfile are in different directories, so you need to use a context where Docker can access both files:
labs
└─ images <- this is the context
└─ java <- so Docker can get the class file from here
└─ lab <- and the Dockerfile from hereBuild the image using that context and specifying the path to the Dockerfile:
docker build -t java-hello-world -f labs/images/lab/Dockerfile labs/imagesRun a container from the image:
docker run java-hello-worldThe output should say
Hello, World
Back to the exercises.