A script that inspects the DNS TTL for a JVM in a supplied Docker image. The image must also contain a JDK.
It does this by generating a Docker image containing a Java program that outputs the JVM's DNS TTL and executing this, then cleaning up the container, image and temporary files.
$ ./jvm-dns-ttl-policy.sh openjdk:8
This will download the image if necessary and then output the image JVM's DNS TTL:
Building Docker image based on openjdk:8 ...
Testing DNS TTL ...
Implementation DNS TTL for JVM in Docker image based on openjdk:8 is 30 seconds
Optionally you can pass an argument --enable-security-manager
to the script and it will test the behaviour with a security manager enabled.
$ ./jvm-dns-ttl-policy.sh openjdk:8 --enable-security-manager
Which outputs:
Building Docker image based on openjdk:8 ...
Testing DNS TTL ...
Implementation DNS TTL for JVM in Docker image based on openjdk:8 (with security manager enabled) is -1 seconds