This is an example of a Docker multi-stage build.
Multi-stage builds allow Dockerfiles to use separate containers for building and for execution, thereby preventing final containers from being bloated with development tooling.
In this specific exampe, we use the OpenJDK container to compile some Java code and then we build an executable container that only has the JRE. In a real world scenario, the build container would likely also contain tools like Maven and Gradle, as well as the dependencies that these build tools would eventually download.
Docker 17.06
docker build -t multi-stage .
docker run multi-sage