Example Docker image that when echos "Hello world!" when run.

Source: https://github.com/stevenalexander/docker-java8-helloworld

terminal gif

Image has JRE rather than JDK to limit installed components. Tested on Mac using Boot2Docker(v1.5.0).

Requires:

To run:

# compile class
javac helloworld.java

# build image
docker build -t java8-helloworld .

# run image
docker run -it --rm --name my-running-app java8-helloworld