Quick look at how to dish out those size zero docker images that packages your runtime app binaries
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get install oracle-java9-installer
sudo apt-get install oracle-java9-set-default
export JAVA_HOME=/usr/lib/jvm/java-9-oracle
export MODS=$JAVA_HOME/jmods/
> java -version
java version "9-ea"
Java(TM) SE Runtime Environment (build 9-ea+140)
Java HotSpot(TM) 64-Bit Server VM (build 9-ea+140, mixed mode)
> cd /vagrant/
> tree
├── Dockerfile
├── Readme.md
├── src
│ └── com.greetings
│ ├── com
│ │ └── greetings
│ │ └── HelloWorld.java
│ └── module-info.java
└── Vagrantfile
> javac -d mods/com.greetings src/com.greetings/module-info.java src/com.greetings/com/greetings/HelloWorld.java
> java --module-path mods -m com.greetings/com.greetings.HelloWorld
Hello World
mkdir -p mlib
jar --create --file=mlib/com.greetings.jar --main-class=com.greetings.HelloWorld -C mods/com.greetings .
> jlink --module-path mlib:$MODS --add-modules com.greetings --output image
> tree image -L 2
image
├── bin
│ ├── com.greetings
│ ├── java
│ └── keytool
├── conf
│ ├── net.properties
│ └── security
├── lib
│ ├── amd64
│ ├── jexec
│ ├── modules
│ ├── security
│ └── tzdb.dat
└── release
>./image/bin/com.greetings
Hello World
> docker build . -t greetings
> docker run greetings
Hello World
> docker images
greetings latest 31f997624827 34 minutes ago 169.7 MB
<none> <none> fa96f037e908 36 minutes ago 169.7 MB
ubuntu latest e4415b714b62 5 days ago 128.1 MB