If I am understood docker philosophy at all,   its much more convenient  to to run java applications in  other container than  your database container. So IMHO better example would be how to connect those.

Just my thoughts..

Tried this with cache 2017.  but can't get it working

building gives no error but  when i run the  image

> docker run -i -p 57772:57772 -p 1972:1972 -t cache-simple
2018/02/14 08:02:24 Starting Caché...
2018/02/14 08:02:24 Seeked /opt/cache//mgr/cconsole.log - &{Offset:0 Whence:2}
2018/02/14 08:02:24 Something is preventing Caché from starting in multi-user mode,
2018/02/14 08:02:24 You might want to start the container with the flag -cstart=false to fix it.
2018/02/14 08:02:24 Error: Caché was not brought up successfully.

and image exist immediatly.

builded also on ubuntu:xenial but same problem there